You need to purchase the original Apple retail version of OS X 10.5 Leopard.
The retail version is a black colored disc with a star background and Black " X " symbol on it.
Any other kind or colored disc (like gray colored discs) are Apple Computer/model-specific discs and will not work on your G5.
And yes, the retail disc will not be cheap. OS X 10.5 is over 5 years old and is getting harder and harder to find, now.
You could try calling Apple at 1-800-MY APPLE and ask for retail software sales to see if they might have any OS X 10.5 retail discs left is stock.
You will pay Apple's original $129 U.S. price tag if they still have some of these in stock.
If no luck from Apple, try Amazon.
Also try a site for Mac OS software that I found called Fastmac.
They will be more expensive, perhaps more than Amazon, but they will have what you need.