Hi,
Yes, the HP LaserJet Pro 400 M401n is listed in About AirPrint - Apple Support as a supported printer. This means that AirPrint should work, without the need for an additional macOS printer driver or a special iOS app, provided that the printer, the Mac and the iPhone are connected to the same network (Wi-Fi router).
AirPrint works with wireless (Wi-Fi) or wired (Ethernet) network connections. In this case, the printer would be wired (Ethernet) to one of the LAN ports of the Wi-Fi router.
You may want to try the following full procedure in the order described, including the waiting times:
Power off the Wi-Fi router, the HP printer, the iPhone, the Mac, and all other computers and devices. Wait two to three minutes. Power on the router. Wait two to three minutes. Power on the HP printer. Wait a minute or two. Power on the iPhone and the Mac. Finally, power on all other computers and devices.
Please make sure that the printer firmware has been updated to the latest possible version.
Are you using a VPN app on the iPhone? If so, since VPN may affect printing, any change without VPN?