First, the grid space of a map does not represent the actual space a creature occupies, it represents the space that creature controls:
A creature's space is the area in feet that it effectively controls in combat, not an expression of its physical dimensions. A typical Medium creature isn't 5 feet wide, for example, but it does control a space that wide.
A large creature's four-square footprint is an abstraction of its size and generally occupied area. At any given time, it might be located more in one of those squares than the others.
Second, the core process of playing D&D, as outlined in the introduction, involves the following:
The DM describes the environment.
The players describe what they want to do.
The DM narrates the results of their actions.
In essence, the process of playing D&D is a back-and-forth shared storytelling experience. As the player reverts from a large creature into their normal form, the DM and player cooperatively arrive at how the action unfolds. If the player wants their character to revert to medium size and end up in a specific square, they convey that information to the DM.
If there is some reason why that particular space is not an option for the player to end up in after they revert, the DM would describe the reason for this limitation. But this a unique narrative reason for a space not being an option, rather than a general one for the player being forced to end up in a specific space.
More broadly, the player is free to have the action of reverting place their character in any of the controlled/occupied spaces because those spaces are controlled/occupied by the character.
As for how this reversion affects attacks of opportunities, I'd say that, from a standpoint of practicality, it makes sense to have the Druid end up in the same space relative to the larger form as when s/he changed shape in the first place. If the medium form were in the lack left square relative to the polar bear, it makes sense to have the reverted form end up in that same square.
Does that mean they get a "free disengage?" They burned a bonus action to revert, so I'd argue it wasn't free and point to Rogue's Cunning Action, another level 2 ability that allows a character to Disengage as a bonus action.
What about a situation where the druid and enemies have equal movement? The druid is now just beyond 5' range, so if s/he reverts and moves, the enemies will have to Dash to cover that 5' gap and get within attack range again.
Consider that an untransformed Druid is a caster and having enemies in melee with them (even if the foes used their action to Dash) is a very unhappy situation for that Druid to be in. If the Druid uses its action to Dash in addition to its bonus action to revert, they likely have just dashed away from other melee members of the party who could help.
Bottom line, if the DM is so concerned with being able to deal damage to the Druid that s/he is breaking out the proverbial measuring chains, you might have a larger issue to resolve at your table.
I'd say it's better to look at it this way: certain classes get certain perks and them's the perks of being a Druid.