But we call Ivory Coast, 'Ivory Coast' not 'Côte d'Ivoire'. Same goes for Spain, Germany, Italy, etc.
For the same reason we call Puerto Rico "Puerto Rico", not "Rich Port".
There actually is no rhyme nor reason why English names are used instead of local names in some instances, but not in others.
hi! Hopefully someone can unravel the history of the English names "Costa Rica" and "Ivory Coast" for you, but just fyi, the question of national exonyms comes up in this sub fairly often (usually wrt "Germany" vs. "Deutschland"). Check these out:
/r/AskHistorians FAQ: Why do countries have different names in other languages?
/r/Linguistics FAQ: Why are our names for countries so different from what the people call their own country?
an old one with more examples How did countries translate the names of other countries?
as an aside, there have been a couple of related posts for city names