An Etymological Dictionary of the German Language/Hafen
Hafen (1.), m., ‘pot,’ from MidHG. haven, m., OHG. havan, m., ‘pot’; a specifically UpG. word unknown to the other dialects. It belongs to the root haf (pre-Teut. kap), lit. ‘to comprehend, hold,’ which appears in HG. heben, and not to haben, root hab (pre-Teut. khabh).
Hafen (2.), m., ‘port, haven, harbour,’ a LG. word, unknown to UpG.; it was first borrowed in ModHG.; in MidHG. hap, n., habe, habene, f., formed from the same root. Du. haven, f., late AS. hœfene, f., E. haven, and OIc. hǫfn, f., ‘harbour,’ correspond in sound to MidHG. habene, f. LG. haven, Dan. havn, Swed. hamn, are masc. — 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 prim. sense would be ‘receptacle’; comp. Hafen (1.). This is the usual explanation; for another etymology see under Haff. Perhaps, however, OIc. hǫfn is primit. allied to the equiv. OIr. cúan (from *copno?).