The official name for Mexico is: the United States of Mexico, as given by its Constitution, ratified on the 4th of October, 1824.
In its strictest sense, and this is really not used much, Mexico implies the City of Mexico, the Federal District, which is the nation’s capital.
There are two theories explaining the meaning of the name Mexico:
1. in Náhuatl the letter “x” is pronounce as the English “sh”. Mexi was the name the aborigines (the Mexicas) gave their principal god and the “-co” is a suffix denoting place, so Mexico would be the place inhabited by the principal god of the Mexicas.
2. in Náhuatl, metztli (moon), xictli (navel, center) and –co (adverbial suffix denoting place) combine to make Mexico, in this theory understood to mean “place at the center of the moon” or “place in the lake on the moon,” which was one of the names for the Texcoco lake. This is the more accepted theory.
Subsequently the sounds changed to that of the “j” (rough “h” in English), although the character remained the same.
Although Mejico is an acceptable spelling according to the Real Academia Española, the only spelling considered acceptable to Mexicans and which is preferred by the majority of Hispanics is Mexico. The “x” is retained in all the derivatives: Mexican, Mexicanism, etc. This orthographic archaism has been maintained throughout the American continent, while in Spain the normal spelling was not until very long ago Mejico, etc.
In sum, although the spellings with “j” are correct, it is recommended to use the “x” as this is how the country in question prefers it, as does the rest of the continent.
Mexicans themselves have accepted some changes of the “x” for the “j” such as: Xalapa which is now Jalapa, and Xalisco which is now Jalisco.