An Etymological Dictionary of the German Language/Annotated/Hafen
Hafen (1.), masculine, ‘pot,’ from Middle High German haven, masculine, Old High German havan, masculine, ‘pot’; a specifically Upper German word unknown to the other dialects. It belongs to the root haf (pre-Teutonic kap), literally ‘to comprehend, hold,’ which appears in High German heben, and not to haben, root hab (pre-Teutonic khabh).
Hafen (2.), masculine, ‘port, haven, harbour,’ a Low German word, unknown to Upper German; it was first borrowed in Modern High German; in Middle High German hap, neuter, habe, habene, feminine, formed from the same root. Dutch haven, feminine, late Anglo-Saxon hœfene, feminine, English haven, and Old Icelandic hǫfn, feminine, ‘harbour,’ correspond in sound to Middle High German habene, feminine Low German haven, Danish havn, Swedish hamn, are masculine. — Phonetically the derivation from the root hab (khabh), ‘to have,’ or from haf, hab (kap), ‘to seize, hold, contain,’ is quite possible; in both cases the primary sense would be ‘receptacle’; compare Hafen (1.). This is the usual explanation; for another etymology see under Haff. Perhaps, however, Old Icelandic hǫfn is primitively allied to the equivalent Old Irish cúan (from *copno?).