A smart aleck, sometimes spelled smart alec, is someone who is self-assured to the point of impudence. The term is usually used to describe someone who is being annoying or self-righteous, and sometimes implies that someone is too smart for their own good. Another common term for the same sort of person is “wise guy,” with both terms adding a slightly ironic inflection to generally good things like being smart and wise.
Many people wonder if there was an original Aleck for whom the phrase is named, and the answer is yes. As so rarely happens with slang terms, the history of “smart aleck” is actually relatively easy to trace, thanks to the efforts of multiple historians who were curious about the original aleck as well. Their search for the first smart aleck was aided by well-kept records, which tracked the first Aleck back to the 1800s.
The first Aleck was Aleck Hoag, a confidence man in New York City who appears to have operated in the 1840s. Aleck was a pimp, and he used the activities of his women to reap additional income through a scheme called the “panel game.” Aleck would wait until the customer was asleep or otherwise occupied, and then he would sneak into the room to steal the customer's wallet and valuables. Patrons got wise to this scheme, and they started blocking doors with chairs and tables. In response, Hoag built false wall panels which slid aside so that he could enter the room without entering the door.
This particular smart aleck qualifies as a wise guy for several reasons. He clearly evaded capture for long enough to develop quite an elaborate system for relieving people of their money and valuables. He also openly boasted about the panel scheme, demonstrating it for curious visitors. Furthermore, Hoag also attempted to avoid paying the police their cut, and “smart aleck” may have actually originated in the constabulary. It didn't take long for Hoag to become well known, and “smart aleck” was a common term in 1860s slang.
As a general rule, “smart aleck” is not a complimentary term. A smart aleck tends to be bold and rather cocky about it, and these traits tend to be frowned upon by many societies. The term may be used pejoratively, in the hopes of encouraging someone to reform, or it may be used in reference to someone who is essentially incorrigible, as a warning to people who might deal with that person.