Connecting to Wifi, just means you are connected to your router, it does not indicate any internet connectivity. There are a couple of things you should do:
- If you have a VPN installed on your iPhone, remove it. Turning off makes no difference and network issues will continue until removed. Check at Settings > General > VPN & Device Management.
- Restart your router. Even though connectivity is working with your other 2 devices, restarting the router is the basic step recommended that resolves many issues.
- Try resetting the network settings on your phone. This will clear your previous WiFi password and you will need to enter it again the first time you connect to WiFi. Go to Settings > General > Transfer or Reset [Device] > Reset > Reset Network Settings.