If you have 10.5.8, then you have Leopard. Anything starting with 10.6 is Snow Leopard, which is a newer version of the Mac OS. The problem you're having is the XCode software is designed to run only on Snow Leopard, and does not support Leopard.
Therefore, your options are:
1. Buy Snow Leopard and install it. If you really need the latest version of XCode, this is your only choice.
2. Use the version of XCode on your install disc. If you still have the discs that came with your computer, on one of them should be XCode. This version of XCode will not be the newest, but it will (probably) work on your computer.
3. If you lost your discs, try downloading older versions of XCode, or check the system requirements to make sure the version you're downloading actually runs on Leopard.