It may not have been the hard drive that needed changing at all, especially as you didn't test it before dumping it.
It sounds like some other hardware is the problem, it could be bad RAM or even a faulty motherboard.
You can test the RAM with
Memtest86 on a bootable CD. Download the CD Image from here:
http://www.memtest.org/
Use
ImgBurn to create a CD from the CD Image, then boot your PC from it:
http://filehippo.com/download_imgburn
Don't be too hasty to blame the hard drive in future, at least not until you've tested it.
Another thing I should mention is that your PC manufacturer may not have any XP drivers for your model, especially if it had Windows 7 pre-installed on it. So check that out before installing XP.