The Muhajiroon were the first Muslims like Umar, Abu Bakr (ra) and so on. They were the first ones to embrace Islam and they made Hijra with the Prophet (saw).
The Ansar were the Muslims from Medina who gave support and pledged allegiance to the Prophet (saw) and made Hijra possible with the permission of Allah.
The Muhajiroon are better than the Ansar and both are great. 4 leaders after the Prophet (saw) were from the Muhajiroon.