Yes, you can "upgrade" your HD ... but there is a lot more to it than just bungin in a new drive and turning on the PC.
You have a Dell, well that tells me you do not have a "real" copy of Windows, so you may need to get yourself one ... However, your Dell should have a Microsoft "Proof of Licence Certificate of Authenticity" on it somewhere with your Product Key ... You can use anybodies copy of XP to install to the new HD, make sure, if you have XP Home, that you use an XP home CD, & a Pro CD if you have XP Pro.
The "trick" is to use YOUR Product Key, which is licenced to you, and NOT the Key that came with the CD ... fear not, this is not illegal.
You will need to make sure you have all the driver required for your particular Dell, they should be easy enough to find from Dell's website.
There is some "preparation" to do to the HD prier to installation, which is simply ensuring the little "jumper" on the back of the drive is set to master, and not slave or cable select as some drive manufacturers seem to do. It's then just a case of connecting it the same way as the one in you PC ... On Dell's website I think they even show you how to do this ... with pretty pictures.
The reason the E-Machine HD did not "work" could be many, but more likely it was crap just like their PCs.
Enjoy!