My old-fashioned
American Heritage College Dictionary (printed!) agrees with all of this but also adds a little.
Under "obsolete"
english definitions, it lists the ship's galley as well as cast iron ranges and outdoor cooking equipment. It mentions that the etymological source is uncertain, suggesting either Dutch or Middle Low German sources in the same vein as was noted in previous posts.
Seems to me that the evidence points to the stomach, with early railroaders sourcing a sea-faring term to refer to where the vittles are made.
It should be noted that Dutch, German (both high & low,) and indeed English, are closely related languages. It makes sense that English would rip off a Germanic term and screw it all around