Uncle Sam (initials U.S.) is a common national personification of the American government or the United States in general that, according to legend, came into use during the War of 1812 and was supposedly named for Samuel Wilson. The actual origin is by a legend.
Since the early 19th century, Uncle Sam has been a popular symbol of the US government in American culture and a manifestation of patriotic emotion. While the figure of Uncle Sam represents specifically the government, Columbia represents the United States as a nation.
The first reference to Uncle Sam in formal literature (as distinct from newspapers) was in the 1816 allegorical book The Adventures of Uncle Sam, in Search After His Lost Honor by Frederick Augustus Fidfaddy, Esq. Other possible references date to the American Revolutionary War: an Uncle Sam is mentioned as early as 1775, in the original lyrics of "Yankee Doodle", though it is not clear whether this reference is to Uncle Sam as a metaphor for the United States, or to an actual person named Sam. The lyrics as a whole celebrate the military efforts of the young nation in besieging the British at Boston.
The earliest known personification of the United States was as a woman named Columbia, who first appeared in 1738 (pre-USA) and sometimes was associated with another female personification, Lady Liberty. With the American Revolutionary War came Brother Jonathan, a male personification, and Uncle Sam finally appeared after the War of 1812.
Columbia appeared with either Brother Jonathan or Uncle Sam, but her use declined as a national personification in favor of Liberty, and she was effectively abandoned once she became the mascot of Columbia Pictures in the 1920s.
More info and source: Wikipedia.