It is because of "на". It's the prepositional case. By itself: "стол" (table) With "на": "на столе" (on table)
If you didn't change it that way, it wouldn't be clear what is "on" what.
If you wanted to change the meaning to "table on box" it would be something like "на стол коробке".
Так: Box on table = на столе коробка Table on box = на стол коробке