William Frederick ("Buffalo Bill") got his nickname after he undertook a contract to supply Kansas Pacific Railroad workers with buffalo meat. The nickname originally referred to Bill Comstock. Cody earned the nickname by killing 4,860 buffalo in eighteen months (1867-68).
In addition to his documented service as a soldier during the Civil War and as Chief of Scouts for the Third Cavalry during the Plains Wars, Cody claimed to have worked many jobs, including as a trapper, bullwhacker, "Fifty-Niner" in Colorado, a Pony Express rider in 1860, wagonmaster, stagecoach driver, and even a hotel manager, but it's unclear which claims were factual and which were fabricated for purposes of publicity. He became world famous for his Wild West Shows.