iMac 27“ Mid 2011 - Can‘t reinstall macOS

It sounds like you've somehow installed a MacOS installer disk onto your internal drive. Then you're booting up to that, and trying to install the OS over itself, or trying to partition the volume of the running system.

Boot to Recovery (Command R at restart) and wipe the disk from there. Then install the OS.