Welcome to Android Central! Not all wi-fi networks are actually connected to the web. Some wi-fi networks are only for communication between local devices.
Some public wi-fi networks also require you to log in on a welcome page in the browser. If you're on a public network, open your browser and try going to any website (like yahoo.com), and see if you get redirected to a wi-fi login page.
If you're at home, are you sure your wi-fi network is set up correctly, and that your home internet service isn't having an outage?