Mam = I have, imię = first name is obvious, but the na makes no senste to me.
You must think of it as a fixed phrase:
mieć na imię = to be called (by name)
You must also remember how we ask for one's name:Jak
(how) masz na imię (not "co" masz na imię).
Jak masz na imię? = How are you called?
Mam na imię XY. = I'm called XY.
Of course, it's not a literal translation but an analogy that may help you remember it.