The computer is most likely malfunctioning because the hardware drivers installed on the drive were from a different system. They're confusing your current system. If you have a Windows CD or an old Win 98 floppy disk, you can boot to either one and use fdisk to erase and reformat the drive.
If you have neither of those, go to a friend's house and download a bootable DOS disk from
HERE. You can learn about fdisk
HERE.
You should have been provided with driver disks for you barebones system. If not, you're going to have to determine your motherboard manufacturer and model and also any other cards and peripherals and go to the manufacturers' sites to download drivers for them.
Best of luck!
P.S. There's also the possibility that your old hard drive is bad.
P.S.S. And the problem with the Linux may be hardware compatibility issues. What distribution of Linux is installed? The odds are, now that I think about it, that if you couldn't boot with XP and you can't get it to work properly with Linux, then you probably
do have a hard drive issue.
Sadly, you could also have an issue with some other area of your new system...mobo, RAM, etc. Sorry for all the bad news. A problem like this is going to be a bear to troubleshoot because you don't know the integrity of numerous of the components.