Hi,
The printer and the iPhone must be connected to the same network (Wi-Fi router).
You could also try to power cycle the router and the iPhone, in accordance with the following sequence (including the waiting times): Power off the Wi-Fi router, the printer, the iPhone, and all other devices/computers. Wait two to three minutes. Power on the router. Wait two to three minutes. Power on the printer, Wait a minute or two. Power on the iPhone. Finally, power on all other devices/computers.
About AirPrint - Apple Support
Use AirPrint to print from your iPhone or iPad - Apple Support