The issue you must answer is whether or not the IDE drive controller built into the machine's mobo (and thus its BIOS) includes what is called "48-bit LBA Support". Just plain "LBA Support" or "Support for Large Hard Drives" is not sufficient. The "48-bit" part is important. That feature is necessary for your system to be able to use any HDD over 137 GB. Given the date when these units were sold, there is a good chance it DOES have that feature. At worst, there is at least a good chance that the BIOS in it can be updated to a new version that does have the feature. Contact Dell Tech Support to get your answers.
You also need this feature in the OS you are using. If you are using a Windows version, it MUST be Win XP with at least Service Pack 1 included. In fact, if you're using XP I recommend you upgrade to SP3, the last version. If your OS is Vista or Win 7 you DO have the feature and can stop worrying there.
If you have only the first version of Win XP or some earlier Windows installed on the old 40 GB drive, you MUST upgrade BEFORE you go to install the new HDD. Otherwise it cannot handle the 500 GB unit, even if your BIOS can.
When proceeding, I highly recommend that you go to the WD website and download and install their utility Acronis True Image WD Edition (assuming you do buy your new HDD from Western Digital, and not some other manufacturer). READ the manual for this, especially the part on CLONING your small older drive to a new larger one. That makes the whole migration process really easier. NOTE one peculiarity I've seen in these cloning systems. As a first step they must Create on the new HDD a Partition (a designated portion of the HDD) to be used as a "drive" with its own letter name, then Format it. (ANY drive needs to have one or more Partitions Created on it and Formatted before an OS can use it.) The cloning system will do the job for you. BUT they often have their default options set to make the new clone the same size as the old original drive, leaving you with a VERY small new C: drive and a lot of unused space in which to create another Partition to be used separately. In my experience, most people like you want ALL of the new HDD to be that C: drive. To do that you must find the menu choices to specify the new Partition's size yourself, instead of just letting it use its default settings.