Is it possible to download and install macOS on a HP computer?

Downloading and installing are two different things.

You could download macOS on a HP computer, but Apple’s software license doesn’t allow installation of macOS on any hardware that isn’t Apple hardware.

Likewise, macOS can be installed on virtual machines, but Apple’s software license doesn’t allow installation of macOS on a virtual machine that itself isn’t running on Apple hardware.

If you’re asking if it’s technically possible to download and install macOS on non-Apple hardware, the answer is yes. However, in addition to being in breach of Apple’s software license, it’s also not an easy thing to do and is out of scope for this site.