Middle English smert, from late Old English smeart, in reference to hits, blows, etc., "stinging; causing a sharp pain," related to smeortan "be painful" (see smart (v.)). The adjective is not represented in the cognate languages.
Of speech or words, "harsh, injurious, unpleasant," c. 1300; thus "pert, impudent; on the impertinent side of witty" (by 1630s). In reference to persons, "quick, active, intelligent, clever," 1620s, perhaps from the notion of "cutting" wit, words, etc., or else "keen in bargaining."
From 1718 in cant as "fashionably elegant;" by 1798 as "trim in attire," "ascending from the kitchen to the drawing-room c. 1880" [Weekley]. For sense evolution, compare sharp (adj.); at one time or another smart also had the extended senses in sharp.
Attested from late 12c. as a surname, earlier as a component in them, including Christiana Smartknave (1279). In reference to devices, the sense of "behaving as though guided by intelligence" is attested by 1972 (smart bomb, also the computing smart terminal). The figurative smart cookie "clever, perceptive person" is from 1948.