The Spanish eje for “axle” comes from the Latin for the same, axis. The English axle comes from the same common ancestor as the Latin axis, the proto-indo-european root *aks– also meaning the same.
The Spanish eje is easy to understand if we remember that most of the x/sh/ch sounds in Latin and the ancient languages became the throat-clearing -j- sound in Spanish. Thus, the e-j of eje maps to the a-x of axle pretty clearly.
It’s interesting how such a simple word has remained mostly unchanged for tens of thousands of years. Perhaps, the axle is one of the most fundamental discoveries in human history. It is, after all, what led to the wheel, which led to… civilization.