iMac G5 works very loudly. How to fix it?
If you think that the fans are running at a higher speed that they should, you could try reseting the SMU.

If the issue is just with the sound being too loud, then the best option would be to open the computer and clean the dust, mainly from the fans and the ventilation-related. Even more, overheat could have caused the fans to slightly bend, making some annoying noises. If that is the case, the only option would be to replace it with a new one. Replacing the thermal grease could be helpful too, if you've got overheating issues.