By unearthing a Mac mini M1 and locking it all inside an old iMac, a YouTube content creator gathered what he calls the world’s first Apple Silicon iMac, with major warnings.
Miani points out that the motherboard of the Mac mini is so small that it can fit snugly into the chassis of the iMac without any modification. Using an HDMI display adapter from the Mac mini motherboard to the Apple iMac custom display connector was the vast majority of project work.
Basically, the Mac mini runs unmodified inside the chassis of the iMac and uses it as a screen with the help of these adapter circuits. This, however, has several limitations.

The Mac mini is held in place by a screw inside the iMac
First, the 2011 iMac has a very low resolution by current standards. Its 27-inch 2560 by 1440 pre-Retina display is not an ideal way to use macOS. Second, the “computer” part of this configuration is the Mac mini, inside the chassis of the iMac. With the current version, all the ports (and the power button) are inside the chassis and are completely inaccessible from the outside without removing the screen.
Finally, Bluetooth and Wifi radios were optimized for an array of three antennas used in the Mac mini, but one of these antennas was integrated into the chassis of the Mac mini. It overcame this limitation by connecting the additional antenna to the antenna wiring of the iMac.
Although the project was a great success, Miani says the setup is not recommended even though it is easy to achieve. However, it says that turning your iMac into a screen for the Mac mini is worth it if you have any.