Wi-Fi only connects your device to the router. The router then connects to the wider internet. When the router-to-internet link fails, every device on the network can show full Wi-Fi bars while loading nothing.
The first thing to test is another device. If every phone, laptop and tablet on the same network has the same problem, the router or the internet service provider is the cause. If only one device is affected, the problem is local to that device.
Routers can lose their upstream connection for many reasons: a provider outage, an expired session, or a firmware glitch. A restart often re-establishes the session and restores service in a few minutes.
DNS problems create a special case. The device can reach the router and the router can reach the internet, but name lookups fail. Websites appear unreachable even though the connection itself is fine, and switching DNS servers fixes it.