Remove the hard drive, it's easy on your model iMac.
Put your iMac G5 face down. Loosen the screws along the bottom of the display. Pull up the foot to remove the back. Take out 4 screws around that hard drive.
Put that hard drive in an external case, and you can do what you need to do with the files.
The hard drive has an SATA interface, so you would need a case that will connect that type of hard drive.