"railroad" and "sandbox" came to be the antonyms for each other
Which is problematic because treating those terms as polar opposites tends to distort their historic and useful meaning.
Let me see if I can unpack that statement a bit:
Railroading, in the purest sense of the term, is something that happens at the gaming table: The GM negates the choice made by a player in order to enforce a pre-conceived path through the adventure.
In practice, of course, the term has bled over into scenario prep. We talk about "railroaded adventures" all the time, by which we generally mean linear scenarios which are designed around the assumption that the PCs will make specific choices at specific points in order to reach the next part of the adventure. If the PCs don't make those choices, then the GM has to railroad them in order to continue using the scenario as it was designed.
By contrast, non-linear scenarios don't assume that the PCs will make specific choices.
So if you're looking for antonyms, those are the useful opposites:
(1) GMs negating player choices vs. players being free to make any choice.
(2) Scenarios assuming specific PC choices/actions vs. scenarios that don't.
(These are both scales with wide areas of gray between the extremes.)
IME, this is what most people mean by railroad/linear vs. non-linear play/design.
Meanwhile, off to one side, we have the term "sandbox". The most useful definition for sandbox I've heard is something along the lines of, "Allowing players to choose the scenario." IOW, you get sandbox when the entire world is
designed as a situation, allowing the players to decide what their next adventure will be.
And here's where we run into the problem with treating "sandbox" as the opposite of "railroad". Because the opposite of a "sandbox" is a campaign in which the players
don't have control over scenario selection: The opposite of sandbox is the prototypical campaign in which the GM comes prepared with a specific scenario for the game session and the players are expected to play through that scenario.
That catch is that I think most people would consider "the GM has a scenario and the players are expected to play it" to be extremely light railroading (if they considered it railroading at all). IOW, I think the severity of railroading is perceived to increase from the outside in: Predetermining that a particular scenario is going to be played is very light railroading. Predetermining the sequence of encounters is heavier railroading, but not as severe as predetermining the exact outcomes of those encounters ahead of time.
So when we cast "sandbox" and "railroad" as antonyms, we actually end up treating the
lightest form of railroading as if it were the
extreme form of railroading. And, in response, the meaning of "sandbox" gets warped towards meaning "any sort of non-linear design". Neither distortion is useful.
My final two-bits:
Railroading: Railroading happens when the GM negates the choice made by a player in order to enforce a pre-conceived path through the adventure.
Linear Design: Designing a scenario around a predetermined sequence of events and/or outcomes.
Non-Linear Design: Designing a scenario in which specific outcomes or events are not predetermined, allowing freedom of player choice.
Sandbox Campaigns: Campaigns in which the freedom of player choice is extended to include the choice of scenario. (And, specifically, it is the PCs choosing the scenario within the context of the game world.)