Try inserting the software dvd that came with your G5 and see if it mounts. If it does, the drive itself is ok.
It's would probably be easiest to just do an "archive and install" of a new OS from your dvd for the G5. The driver probably got currupted on your hard drive. If you're not familiar with archive and Install just look it up on Mac help. It doesn't wipe any stuff off your hard drive, just install a new os and keeps an copy of your old one.
To check the usb slot on your keyboard, try a different device like another mouse. Sometimes it's not the plug, but the wire from the device. Occasionally I have the keyboard usb plug on my third party keyboard stop responding to my third party mouse, I just unplug and replug and all is well after that.
Using OSX 10.3.9 on a G4