You would need to use another Mac and make a bootable USB/CD of the correct version of the latest support MacOS or lower (Minimum is 8.0) usually done within the terminal.
If you do not have another Mac there are ways to do it in a Windows VM using some special code off of GitHub. I personally run a Big Sur VM to do all my iPhone work on and for making bootable macOS USB’s to fix my clients machines. If you have to go the VM route, let me know I can provide all the tutorials and guides you will need :)
Depending on your model of G3 you should able to go to 9.1 on all models and as high as10.4.11 on the G3/500 (Firewire/Pismo) model.
Hope this helps :)