"would-be witty or clever person," 1854, from smart (n.) + -y (3). Extended form smarty-pants is attested by 1939.
Entries linking to smarty
smart n.
late 12c., smerte, "sharp physical pain," from smart (adj.). Cognate with Middle Dutch smerte, Dutch smart, Old High German smerzo, German Schmerz "pain." Of mental pain or suffering from c. 1300. In old cant, "a dandy," 1712. Smarts "good sense, intelligence," is recorded by 1968 (Middle English had ingeny "intellectual capacity, cleverness" (early 15c.)).
-y 3
suffix in pet proper names (such as Johnny, Kitty), first recorded in Scottish c. 1400; according to OED it became frequent in English 15c.-16c. Extension to surnames seems to date from c. 1940. Use with common nouns seems to have begun in Scottish with laddie (1546) and become popular in English due to Burns' poems, but the same formation appears to be represented much earlier in baby and puppy.