The original word for Mexico was probably Meshtleeko. This word was a mine field of pronunciation for the missionaries. Native Spanish speakers have a difficult time pronouncing sh, whether in an English or a Mexican word. As a result, they inserted an x in any word containing sh, thus x came to be pronounced sh.
As the first missionaries to come to the New World from Spain, the Franciscans used the x to help commit indigenous Mesoamerican languages to script using Latin characters. Whenever they couldn't translate the sounds of letters to Latin, they used an x, much like . . .