Interestingly (to me, any way), if you look in the Metabase database there are 3 fields at play:
dataset_query is the query itself
visualisation_settings - just sets whether or not the table should be pivoted (no ordering)
result_metadata - the data types of the data.
The first and last of these have the fields in the order in which you originally created the query. Swapping them makes no difference at all other than changing the order of the groups in the Grouped By list.
Edit: When you pivot, whichever axis has most values is assigned to the left. In my test I had 6 employees against order date with total sales.
With the date set to per quarter, the employees were down the left. With the date to to per month, employees across the top.