Historians disagree on how he got his name -- either he was originally the likeness of a real-life American businessman named Sam Wilson, or it was derived from a mocking nickname given to the United States Light Dragoons (USLD), a cavalry unit whose initials were derisively said to actually stand for "Uncle Sam's Lazy Dogs." In any case, when Uncle Sam came into common use, it was in caricatures drawn for anti-government propaganda magazines, who basically wanted a shorthand way to represent the entire government as one cranky old shithead in a flag costume.
Here, he gets his ass kicked by Canada. Canada.
The turning point for Uncle Sam's reputation didn't come about until the 1870s, when due to lucky coincidence, people noticed that he looked an awful lot like Abraham Lincoln, especially when Lincoln grew out his goatee (during his experimental phase). After that, artists started to go with it and straight-up draw the character as Abe in a gaudy suit.
Of course, Lincoln came to be known as one of the country's most beloved leaders, so the snide caricature who came to mockingly resemble him began to ride on the coattails of Lincoln's own reputation, until the government adopted him as a source of pride, because the government is frequently tone-deaf that way. They made Uncle Sam the spokesman for the famous "I Want You" campaign, and the rest is history.
Kena Betancur/Getty Images News/Getty Images
Now, he's a Macy's balloon, and we ignore his dark past. Just like Garfield.
Had Uncle Sam inadvertently borne a closer resemblance to James Buchanan or Jefferson Davis than Abraham Lincoln, America would've wound up with an entirely different cartoon mascot. Probably.