Uncle Sam. The United States Government. Mr. Frost tells us that the inspectors of Elbert Anderson's store on the Hudson were Ebenezer Wilson and his uncle Samuel Wilson, the latter of whom superintended in person the workmen, and went by the name of “Uncle Sam.” The stores were marked E.A. - U.S. (Elbert Anderson, United States). and one of the employers, being asked the meaning, said U.S. stood for “Uncle Sam.” The joke took, and in the War of Independence the men carried it with them, and it became stereotyped.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894