Old English æcern "nut, mast of trees, acorn," a common Germanic word (cognates: Old Norse akarn, Dutch aker, Low German ecker "acorn," German Ecker, Gothic akran "fruit"), originally the mast of any forest tree. It is by most sources said to be related (via notion of "fruit of the open or unenclosed land") to the source of Old English æcer "open land," Gothic akrs "field," Old French aigrun "fruits and vegetables" (from Frankish or some other Germanic source); see acre.
The sense was gradually restricted in Low German, Scandinavian, and English to the most important of the forest produce for feeding swine: the mast of the oak tree. The regular modern form would be *akern; the current spelling emerged 15c.-16c. by folk etymology association with oak (Old English ac) and corn (n.1), neither of which has anything to do with it. Acorn squash is attested by 1937.