While you can this information via the "Network Connections" GUI, it could come in handy sometimes to know where this is located. For example, you might want to write a script to display the SSID and passwords of all the Wi-Fi networks you've connected to.
Basically, all the network connections are saved under /etc/NetworkManager/system-connections in Ubuntu in separate configuration files. If you want to delete all the Wi-Fi settings in bulk (for privacy reasons or if you're having some weird connection issues), you can also just quickly delete them from here.
To see the Wi-Fi password and other settings for the network you're connected to, just do:
sudo cat /etc/NetworkManager/system-connections/THE_SSID_OF_THE_WIFI