A failing hard drive would be the most likely issue, but a bad GPU or bad power supply are also a possibility. I seem to recall some of those iMacs having a swollen/leaking capacitor on the power supply board.
You can try booting up from the second CD/DVD which originally shipped with the iMac from the factory to boot into the Apple Hardware Test. You may also be able to find an Apple Hardware Test or Diagnostic for it where you can create a bootable diagnostic USB stick on this site (all links for downloads are from Apple's own servers, so the files are all safe and original Apple downloads). IIRC, when you open the DMG file you will see a README file which has instructions for making a bootable diagnostic USB stick. If you really have a 2008 iMac as opposed to a 2007 or 2009 which are very similar, then you will need the iMac8,1 link:
https://github.com/upekkha/AppleHardwareTest
Keep in mind that the diagnostics rarely find issues, but it never hurts to try anyway.
You can also try booting the original iMac gray Restoration DVD or the later OS X 10.6 Snow Leopard Upgrade DVD to see if the iMac will boot from CD/DVD. This is more of a test to make sure the iMac can actually boot an OS.
I can also provide you instructions for creating & using a bootable Linux USB stick to check the health of the internal hard drive.....it is also able to show you whether this iMac will boot any OS without powering off which may provide more information for troubleshooting the problem. Just let me know if you are interested in this option.