Will a harddrive out of a hp laptop work in a dell

Will work if you reinstall the OS and if the interface is the same.
Just moving the HDD from one system to another will require a new activation of the OS, and since brand PCs usually come with a OEM version of Windows, the license is not transferable. You will need a new license for Windows to work in the new system. The OS will not recognize the new hardware (usually the mobo) and will know it's another system for whom it was not activated.