Why does the independent variable go on the x axis?
Because it is an easy convention. It is NOT required. Often the independent variable is time, and we tend to visualize the "time line" from left to right.
The independent variable in any study is the one that you do not (or cannot) control, but which affect the one(s) that you are interested in (dependent variables). Because are live in a time-defined universe, whether the variable is time or not (if often is), the expression of its change will necessarily follow a timeline.
As the short answer said - we visually think of a timeline as progressing from left to right. But, that is simply a convention. It could be put on any axis and be equally valid, as long as the mathematics represent the axes used.
So, while the previous detailed answer gave some excellent examples, the real REASON we plot the independent variable on the x-axis is just to follow the convention in order to make our results or observations more readily understood by others.
Corollary: If I simply started using base-8 numbers for an equation without explanation, my results might still be valid, but anyone expecting the normal convention of base-10 numbers would be confused. So, we use base-10 for all of our calculations unless the change is specifically noted for particular reasons.