You will need to use a data recovery app such as PhotoRec, TestDisk, or Data Rescue to see if you can find the lost files. You will most likely need to put the G5 into Target Disk Mode or remove the hard drive to connect it externally to a newer Mac using an external USB drive dock as most apps will require a more current version of macOS to run. I've seen reports that more recent versions of macOS may no longer be able to read such an old drive. Be prepared to sort through hundreds and even thousands of files when using a data recovery app and those files may not have any names associated with them.
You can also contact a professional data recovery service such as Drive Savers or Ontrack. Both vendors provide free estimates and both are recommended by Apple.
Please start frequent & regular backups of all your systems and any external media which contains important & unique data.