Enemy traces to Latin inimīcus, a noun formed from an adjective meaning hostile or unfriendly. That adjective combines a negative prefix with amīcus, friendly.
The identical Latin adjective and noun are compressed into one card; enmy is another Middle English spelling.
Sources
- Merriam-Webster: enemy
Amīcus underlies inimīcus, which led through enemi to enemy.
- Online Etymology Dictionary · enemy
Meanings of the older forms on the word path.