Using a WiFi connection is generally preferable to using a 3G/4G connection: you'll generally have a faster and more reliable internet connection with better call quality and, most importantly, WiFi won't use up the data on your plan.
Your phone will connect to and remember many different WiFi networks. You can join your home WiFi, connect to your friends or family members' WiFi at the places you frequently visit, or search for public WiFI networks in your vicinity. (Note that public WiFi may require opening your browser to complete an additional sign-in page.)
To join a WiFi network in your area, go to the Settings application > WiFi > and select the WiFi network name. It can also be known as the SSID (stands for Service Set Identifier), which is a fancy way of saying it's the wifi network name.
Enter the password when it asks you for a password:
Once you’ve setup your WiFi you will see Connected under the WiFi name (Network SSID).
When connected to WiFi you will also see this wifi symbol on the notification bar across the top of your device:
If that symbol is lit up, you're connected to wifi and your 3G/4G data is not being used. Also, the symbol will show you a quick indication of your wifi signal strength: if only one or two bars are lit up, your connection is poor. If it's all four bars, it's strong.
Next time you are in proximity of that same WiFi network you've just set up, your device will remember and connect to it automatically.