Just something going bonkers in your system preferences. Your iMac is running a version of macOS that it was never intended, but that's why you did that, and one result in your particular Mac, running a much newer system. So, something about that newer system (and the connection through OCLP) is giving you have a minor issue. You could turn off all any sleep setting, so it does not try to go to sleep automatically (it's not quite getting there, so maybe best to keep your iMac from sleeping on its own.
(I have an older iMac, running Sonoma. During the install process to get THAT to work, that iMac8,1 now refuses to ever restart. I can only shutdown, then start from completely off. Restarts don't work, at all, even when booting to my other boot system on that iMac, which is Snow Leopard. That won't restart either. Just something I have to remember when I install updates on the OCLP system.
So, what do you do? Go though your various settings, such as login, or energy saving, looking for the various settings that are affected by some time period, such as automatically starting a screensaver, or sleeping after "X" minutes--those kind of settings.
Your goal is to prevent the Mac from responding to any kind of automatic time period (sleep, log out, screensaver timeout, etc), so if you see some choice about a time period, try choosing "Never", or whatever the longest setting might be. Should help in your case.
Yeah, I wasn't suggesting replacing the optical drive, but you could do that if you want. If you are not using the hard drive, THAT's the one you could replace with SSD. And, with that in mind, you have a nearly 15 year old iMac. The other internal piece that might be worth replacing is the PRAM battery. It's just a button battery, a BR2032. It's maybe better known as a clock battery, as it keeps the time, and various other stored settings when you might unplug the iMac occasionally. But, the battery doesn't last forever, and a couple of the settings that it keeps might be related to what you have, like sleep settings. That battery, when low, or maybe dead, might cause strange issues to occur, sometimes a dead battery might keep the iMac from booting properly. Anyway, might be worth opening that iMac up, replacing that button battery, and, while you are there, replacing the old hard drive with an SSD.
Finally-yes, I know this is suggesting some tech-y stuff. You would need tools, and access to take-apart information, and all that goes with that. Not everyone that I suggest repair stuff actually gets there - but, here's help, anyway. Take it for what it's worth...https://www.ifixit.com/Device/iMac_Intel_21.5%22_EMC_2308
Look through those repair guides. You might find it's not as daunting as it looks to replace the hard drive.
And, I also now remember that that little button battery is as hard as it looks (you have to remove almost everything from inside the case to do that one. Well, look at the steps anyway, just for fun. (I suspect that a repair shop would probably charge for 4 hours of labor to do that one (I forget that iMac requires removing the main logic board. It's a complicated job that requires a lot of extra care, and moved quite a lot of fairly fragile stuff. Not sure it's worth doing on a "hope it helps" plan
(I apologize for the book!)