also butter-nut, 1753, nut of the white walnut, a North American tree; transferred to the tree itself from 1783, from butter (n.) + nut (n.). So called from the oil it contains.
The dye made from the tree's inner bark was yellowish-brown, and the word was used (from 1861) to describe the Southern army troops in the American Civil War, but the exact reason is debatable. Many Southern uniforms seem to have been this color; perhaps butternut dye was extensively used in homemade uniforms (but the tree's natural range is mostly in the northeastern U.S.); perhaps some of the regulation gray uniforms faded or soiled to this color; perhaps it was because butternut was a nickname for Southerners in the Midwestern states.