So called because it grows on old walls and ruined buildings. It is a native plant. Similarly, wall-cress, wall-creeper, etc., are plants which grow on dry, stony places, or on walls. Wall-fruit is fruit trained against a wall. (See Walnut.)
Herrick has a pretty fancy on the origin of this flower. A fair damsel was long kept in durance vile from her lover; but at last
Up she got upon a wall, `Tempting down to slide withal; But the silken twist untied, So she fell, and, bruised, she died.
Love, in pity of the deed, And her loving luckless speed, Turned her to this plant we call Now the `Flower of the wall.'
Young ladies who sit out against the wall, not having partners during a dance, are called “wallflowers.”
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894
More on Wallflower from Fact Monster: