When abbreviating Spanish weekdays, the letter X is often used for miércoles (Wednesday), notably in Spain.
The obvious reason is to distinguish it from martes (Tuesday), which also starts with M.
But why X? Why X and not some other letter?
When you search for the reason, two possible explanations tend to appear more often than others.
Alfonso X el Sabio
The first theory claims that the X may be in honor of Alfonso X, nicknamed "el Sabio" (the Wise), the King of Castile, León, and Galicia in 1252-1284. He was known as a supporter of science and wisdom, employed numerous scholars at his court, and as a result his reign brought great advances in many different fields of study, also including translations and liguistics. To honor his contribution to the Spanish language, the letter X started to be used as abbreviation for miércoles when the linguists were looking for some letter to replace the already taken M.
This theory is listed, among many other places, on the Spanish Wikipedia page for the term/day miércoles. However, the deeper one goes into studying the other theory, the less likely the Alfonso X theory appears.
Mercury and merx
The more likely origin of the letter X is related to Mercury, which is not only the planet, but also the Roman god of ... lots of things, including merchants and trade. In fact, the word miércoles itself is derived from Mercury (Mercurio), as are the words for Wednesday in French (mercredi), Italian (mercoledi), and even English (from Odin, or Woden, the Germanic counterpart to Mercury). The name Mercury is believed to be related to the Latin word merx, which means merchandise or commodity. And here we are – the X.
One thing that might also support this theory is the other abbreviation of miércoles which appears in a few (admittedly very few) cases: Mx (the days go like Lu Ma Mx Ju Vi Sa Do/Dg). The Mx abbrieviation is far less common than the others (Mi, Mie, Mié, Miér), but it does appear in a few places. Of course, it does not automatically confirm the merx/Mercury theory for the X abbrieviation of miércoles.
So which is correct?
It is probably impossible to tell with certainty in these days. Whatever the actual reason was, it happened hundreds of years ago.
The Mercury/merx theory appears to have a stronger foundation than the Alfonso X theory. Why don't we use A, which is also still available, after all?
However, it might as well be something completely different.