Question Computer wouldn't boot past BIOS

Aug 30, 2021
Hello Tom's hardware,

My current setup is not a new build. No hardware changes were made.
Out of nowhere my PC just shut itself off one night and when I tried powering it back on, it wouldn't even boot up to the BIOS screen. When I press the power button, I would see all the motherboard lights go on, the CPU fans and case fans are spinning, and all this would last for about 5 seconds before the computer restarts itself again and it goes into a restarting loop but never boot up to the BIOS screen. I also started removing the GPU card, RAM stick 1 by 1, hard drives, and still wouldn't boot past BIOS.

Next I tried using a different motherboard with the same CPU, a GPU card, 1 RAM stick and one hard drive, I was able to boot into my OS. As a test, I restarted and powered off the computer multiple times. after the 4th shutdown, it went back into the constant reboot loop where it doesn't even go past the BIOS.

Next I tried swapping out the power supply with the spare and used the second motherboard, everything is working fine and everything booted up normally.

Finally, I tried using the original motherboard with the original power supply, everything is booting up normally again. I find this so strange and cannot understand why this setup is working again and for how long before it acts up again.

I can't seem to pinpoint what caused the the first incident where it wouldn't boot at all. Then 8 hours later, everything is booting up again with the original motherboard and original power supply. Would this be a hardware issue with the power supply or a motherboard ?