Mac is stuck in some kind of automatic layout windowing mode
Clearly your computer has a window manager installed on it.
That one in particular might be chunkwm (the blue border around your selected window reminds me of my time using chunkwm, but I assume all window managers provide some feature like that). chunkwm is also very popular, so maybe it's what's ended up installed on your computer.
Try stopping it, maybe one of these commands will work:
brew services stop chunkwm
launchctl unload -w ~/Library/LaunchAgents/com.koekeishiya.chunkwm.plist
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.chunkwm.plist

if none are found try searching for it
launchctl dumpstate | grep chunkwm

if chunkwm still isn't found, then the window manager you have isn't chunkwm.
Just look up a list of window managers online and search for each one in turn on your computer. Edit a good starting point would be yabai, the successor to chunkwm.
It might also be possible to hunt through
launchctl dumpstate | grep '=&gt; true' 

for it.