Boy your really pulling at the cobwebs here
If I remember correctly the Power Mac G5 uses a PowerPC chip not Intel which will limit you on which version of OS-X will work. I think Tiger is as high as you can go here.
I don't think your OS is corrupted, just needing some maintenance. If it was corrupted it won't boot up.
OK what to do ...
First you need to make a backup onto an external HD just in case something happens. Make a complete copy to verify you have. go into the system prefs to select the external HD to boot from. It should be the first listed HD on your desktop.
Second now that your running off of the 2nd HD run disk repair on your primary HD. You may need to run it through a few times.
Next you'll need to get a defragging app that runs under PPC I like 'Drive Genius' but any one will do. Defrag your HD. At this point go back into system prefs and select your internal HD to boot from. Hopefully you should be OK. If not you will need to re-install the OS from the original CD/DVD's or copy back your files from the external back on your internal drive.
Make sure you have run a good antivirus across your HD files with the latest defs it should remove any viruses, malware, or other infections from your system.
At this point your need to clean out any old apps that your not using any more as well as look at old system extensions. Be careful in upgrading your apps as newer apps may drop PPC support.