From Old English 'loc' (bolt), from PIE *lewg- (to bend) — same root as 'lock' of hair, both about bending.
A mechanism for fastening a door, lid, or container, typically operated by a key; also, a section of a canal enclosed by gates to raise or lower water level.
From Old English 'loc' meaning 'bolt, fastening, enclosure,' from Proto-Germanic *lukką, from the PIE root *lewg- meaning 'to bend, to turn.' The semantic development runs from 'bending' to 'enclosing' to 'locking shut.' The same root produced Old English 'lūcan' (to close, to lock), and there is a separate but related Old English 'locc' meaning 'lock of hair' — from the notion of something curled or twisted, connecting back to the same 'bending' root. Key roots: *lewg- (Proto-Indo-European: "to bend, to turn").
The English word 'lock' (fastening) and 'lock' (curl of hair) look identical but come from two slightly different Old English words — 'loc' (fastening) and 'locc' (hair) — both ultimately tracing to the same PIE root *lewg- meaning 'to bend,' connecting the idea of a bent bolt to a curled strand of hair.