Chosen Solution

Replaced old power supply. Computer ran well for about 4 hrs after closing it up then the new power supply failed due to heat buildup. Suspect lost cooling air flow. Can a fan failure be the fan only or instead be a problem with the main board’s control of the fan?

More likely the power supply still has the original electrolytic capacitors which are faulty! What is the Great Capacitor Plague? And here’s a bit more: The Great Capacitor Plague of the Early 21st Century

Be sure that the fan is not clogged with dust and that the fan duct is clean. You can also try to use Macs Fan Control to try and keep temperatures down inside your iMac if you determine that the fan and fan duct are clean. iMac G5 20" Model A1076 Fan Duct Replacement iMac G5 20" Model A1076 Left Fan Replacement