Old English ēarwicga combines ēare, ear, and wicga, insect. The word passed through Middle English erwigge into modern English.
The story about crawling into sleeping people’s ears is an old superstition identified by the source, not a claim about normal insect behavior.
Sources
- Online Etymology Dictionary: ear
Also built on *ear* (n.1) "organ of hearing": earlobe, earshot, earwax
- Online Etymology Dictionary · earwig
Meanings of the older forms on the word path.