The problem is you have a G5 iMac. There are a number of issues this platform has had. The power supply and logic board have had capacitor issues that made them intermitant or unable to start. If you look at the logic board check to see if the visible capacitors are bulged. If they are I would look for a new computer. If they are not I would start by replacing the power supply
Let us know what you see when you look at the logic board. Click on the step-by-step-guides at the right to see how tho gain access.