A warm welcome to HP Support Community! I'd like to help.
Do you have 2.4GHz and 5GHz networks enabled on your WiFi router?
Do you have any antivirus software installed on your Mac?
Do you have a guest network enabled on your WiFi router?
Approximately how far is the printer located from the WiFi router?
Could you check for WiFi interference and also perform a ping test using the Mac Network Utility and let me know the results. Use the printer IP address to perform a ping test, the printer IP can be located by touching the wireless icon on the printer display.