Some (especially the cheapest models) are “host based” printers, meaning they rely on a proprietary protocol for communicating with your computer. These models typically only have driver support for Windows, and often only specific versions of Windows. Linux support is sometimes present for these, but Mac support almost never is.
Other models (what I would consider the good ones) use industry-standard languages like PCL or PostScript. These will always work with macOS. Either via driver that HP provides or via drivers Apple bundles (either model-specific, AirPrint or generic PCL/PS drivers).
Before buying such a printer, I strongly recommend visiting HP’s support page, look up the model, and see what kind of drivers/support are listed there. Make sure Apple or HP provides support.
I have the HP Color LaserJet Pro M252dw and it has worked flawlessly with many Macs over what is probably 10 years. It supports both ethernet and wi-fi and uses AirPrint.
I have to say I had a terrible experience with a HP Color Laserjet. Poor quality prints after only a few months, replaced all the toners which wasn’t cheap and to no avail. HP offered to send a technician to service it but once they realised I was in a very remote rural location, that vaporised and I could drop it off and collect it. We cut our losses.
And that’s after being firm fans of our, still operating after over 20 years, HP Laserjet 4250TN.
Brother for multifunctional office printing is hard to beat. Cheap, reliable, quick. Canon or Epson inkjets for when accurate color is vital.