The story
Inversion of earlier smart as a whip (compare rock solid, from solid as a rock; snow-white, from white as snow; etc.). Possibly an allusion to how quickly the tip of a whip moves when the whip is cracked.
Etymology from Wiktionary, CC BY-SA 4.0.