The story
From Old English ongegn (“towards, opposite, against”), equivalent to a- + gyem (dialectal phonological development of "again/again’st"). Preserved in Northern English and Geordie dialects as agyem, reflecting regional vowel shifts and consonant changes.
Etymology from Wiktionary, CC BY-SA 4.0.