To immigrate means “to enter a country with the intention of becoming a citizen.” To emigrate means “to leave a country with the intention of settling elsewhere.”
A trick you can use:
Immigrate means “to come in.” Emigrate means “to exit.”
Example: Cuba is plagued by illegal emigration. The United States, meanwhile, is plagued by illegal immigration.