Unplug everything from the back. Let your iMac sit for a minute or two.
Plug in ONLY the power cord, just as a test. Your keyboard and mouse should work this time.
Do an NVRAM reset as you try to boot up:
Press and release the power button. Immediately press and hold Option-Command-p-r.
You should hear the boot chime sound. Keep holding the same 4 keys until you hear the boot chime two more times, then release the keys to allow a normal boot.
Assuming you CAN boot to your desktop, be sure to open your System Preferences, then Startup Disk. Select your boot drive. You will need to unlock that pane to set the boot drive.
I suggest that your NEXT step will be a restart of your Mac, which can help assure you that your iMac is now working OK.