1630s, from German Sauerkraut, literally "sour cabbage," from sauer "sour" (from Proto-Germanic *sura-; see sour (adj.)) + Kraut "vegetable, cabbage," from Old High German krut, from Proto-Germanic *kruthan.
They pickle it [cabbage] up in all high Germany, with salt and barberies, and so keepe it all the yeere, being commonly the first dish you have served in at table, which they call their sawerkrant. [James Hart, "Klinike, or the diet of the diseased," 1633]
In U.S. slang, figurative use for "a German" dates from 1858 (compare kraut). "The effort to substitute liberty-cabbage for sauerkraut, made by professional patriots in 1918, was a complete failure." [Mencken]. French choucroute (19c.) is from Alsatian German surkrut (corresponding to German Sauerkraut), with folk etymology alteration based on chou "cabbage" + croûte "crust" (n.).