In her book, Tenting on the Plains (1887), Elizabeth Custer, wife of the General, says, “A doughboy is a small, round doughnut served to sailors on shipboard, generally with hash.
Early in the Civil War the term was applied to the large globular brass buttons on the infantry uniform, from which it passed, by natural transition, to the infantrymen themselves.”
That is a reasonably logical explanation.
It might be acceptable if it were not for the fact that twenty years earlier, just two years after the close of the Civil War, a writer in Beadle’s Monthly said, “To us doughboys (the origin of the name is one of the inscrutable mysteries of slang) who wore light blue shoulder-straps and chevrons, and were our own pack-horses, . . . the constant . . . skirmishing into positions, only to abandon them, . . . became a wearisome iteration.”
Regretfully, then, we must continue to say, “Origin uncertain.”