The term “Smart Alec” is thought to have come from the misadventures of 1840s New York City criminal Alec Hoag.
Alec was a pimp and thief. Originally his scam worked like this: his wife, Melinda, would take a “customer” down a dark alley in which Alec was hidden. She’d pick the john’s pockets and hold the loot in her hand; Alec would silently take the goods and disappear into the night while the client was… “distracted”.
Most men would be too embarrassed to report the theft to the cops. But some would, so Alec started paying off local cops by giving them a cut of his ill-gotten gains. For Alec it was win-win.
I’m not quite sure what happened next. Some sources say Alec fell into financial difficulties and couldn’t pay off the police. Others say he simply decided he didn’t want to pay off the cops any more.
Whatever the case, Alec moved his scam into a rented room. Melinda would bring johns back to the room and draw a curtain around the four-poster bed. When the moment was right, she’d cough, and Alec would slip into the room through a false panel and steal the john’s wallet (and anything else of value), then quietly disappear the way he came.
It worked for a while, but when the NYPD found out that Alec had cut them out of his business they arrested him. Some cops took to sarcastically calling him “Smart Alec”, as he was just a bit too clever for his own good.
They say it took a good 20 years, but eventually the phase entered common usage near the end of the Civil War. Although the story hasn’t been proven beyond a doubt, it has consistently been the only story attached to the saying, so it may just be true!