Your Compaq computer should have a little sticker on the bottom of it with your operating system key on it. Did the computer come with Windows XP? Or was it another operating system? If it was originally XP, your best course of action would be to contact Compaq and request a restore cd for the computer. There will probably be a small fee for this service.
If it was another operating system originally, and you want to put in XP, then you'll have to purchase a copy of XP while it is still available. Make certain that there are drivers available for your computer for the XP operating system before doing this.