There maybe people here that say it's not legal, especially since if that version of XP came with your PC, it's tied to that machine and only meant to be used on it.
However, since you legally bought it, and especially since your trashing it anyway, I'd say it doesn't really matter. You can use it. 😉
You may have some problems with "activating" Windows, though. You'll probably need some kind of code printed on a sticker somewhere on your old PC in order to install it at all, but that's no problem. The problem will be activating it.
There are ways around the activation issue, though. Either legal or illegal. You can search google for ways to "crack" the activation. Alternatively (and slightly more legally) you can call up Microsoft and just tell them you're replaced a bunch of things in your PC (motherboard, RAM, hard drive, etc.) and now it's technically a different machine, and won't let you reinstall XP. They'll give you a new code that will work.