They're titles, not names, hence the similarity. They had several changes in titles over the course of their lives, but the full names they are most often associated with are:
Nūr ad-Dīn Abū al-Qāsim Maḥmūd ibn ʿImād ad-Dīn Zengī
and
An-Nasir Ṣalāḥ ad-Dīn Yūsuf ibn Ayyūb
Let's try and break those down a bit, then. The openings of both names are titles. Exact translations will vary as there's not an exact 1:1 for some of these terms to English that captures their full meaning, but we'll try given that caveat.
Salah ad-din means 'Righteousness of the Faith', and Nasir means 'helper' or 'one who brings victory', so the title could approximately be translated as 'one who brings victory for the faith', or 'sword of the faith'. Edit: Al-Nasir also happened to be the contemporary Caliph of Baghdad to Saladin, and his name means 'the victor for the religion of God.' So Saladin's opening title could be interpreted broadly as indicating spiritual victory, or read more literally as 'the victor for the religion of God, righteousness of the faith'.
The next bit, Yusuf ibn Ayyub, is what we would probably consider his proper name. 'ibn' means 'son of', so his name is Yusuf and he is the son of Ayyub.
For Nur ad-Din we can see a similar pattern. The last part of his name is what we would consider his name, Mahmoud son of Imad ad-Din Zengi (often called Zengi, Imad ad-Din meaning 'Pillar of the Faith'). Nur ad-Din means 'light of the faith'. The Abu al-Qasim literally means 'father of Qasim', but usually refers to the prophet Muhammad (Qasim being Muhammad's first son, he died in infancy).
The exact origin of these titles isn't always possible to pinpoint, but often they would be given by the Caliph in Baghdad to the Sultan as a reward for their services to the Muslim faith, or at least that's the theory. There's a lot of politics involved in these titles, and they were valuable pieces of propaganda for those who had them.
Anne-Marie Edde's biography of Saladin has some excellent discussion of how Saladin acquired his titles, and how they changed over his lifetime, along with what they meant within the context of the time. She covers Nur ad-Din a bit as well, but obviously he's not the primary focus.
Paul Cobb's Race for Paradise is a great introduction to the Crusades from an Islamic perspective, and happens to include one of the most concise explanations of Arabic naming schemes I've ever encountered.
Disclaimer: I'm away from my books right now, and my Arabic isn't great, so while I'm pretty sure my translations are accurate, I'm not willing to guarantee that they are beyond improvement.
Edit to add: I should also mention that many Arabic names and titles have a broader historical context and meaning (see for example the Abu Al-Qasim as a reference to Muhammad), and I am not the guy to carefully unpack all of that subtle meaning and significance. I am not Muslim, and my knowledge of Islam is far from comprehensive, so there is very likely some broader context and meaning in these names that I am not full explaining.