How does increasing in size affect adjacent squares and enemies?

Inspired by this question and effectively asking the opposite question. Assuming play is on a grid, what squares can a creature occupy when it goes from being medium size (1×1) to large size (2×2)? Does the square it already occupied when it was medium need to be included in its new form? What are the options for the three additional squares, can they simply be any that would make the creature 2×2? How does increasing in size interact with the “Moving Around Other Creatures” rule which states:

Whether a creature is a friend or an enemy, you can’t willingly end your move in its space.

So if there were a creature in one direction would you not be able to include its current space in your new form/size? What if you were surrounded by creatures, could you increase in size at all?

Some hopefully helpful diagrams: You are C, monsters are X, empty spaces are #.

Can

###   #C#   ###    

change into:

CC#   CC#   ###   

or

#CC   #CC   ###   

What can

XXX   #C#   ###   

change into?

What can happen from this last scenario:

XXX   XCX   XXX 

Note: I am looking for an answer that is rooted in RAW, but if no answer exists there an answer from experience with this issue would also work.

Examples of why this might matter:. If you end up occupying the same space as an enemy then a spell like fireball would no longer be able to target you.
If you push the creatures out of the way this could do things such as pushing then into a moonbeam spell.
If you are not allowed to occupy the same space as the monsters then I am confused what would happen if you were initially surrounded.

What squares can you occupy when your size increases, and do other nearby creatures impact this?