Your WiFi password is set by your router. But if you use iCloud keychain or use a Mac computer, it stores this information for you.
To recover your WiFi password, open the “Keychain Access” app your Utilities folder (MacintoshHD > Applications > Utilities > Keychain Access.) Select the Passwords category and in the search bar type in AirPort network password and then and find the name of your WiFi network. Either right-click the network name and select “ Then copy this password to clipboard or right-click it, select Get Info and check the Show Password box. You need to enter your Mac’s administrator account username and password to get this information.
If this doesn’t work or you don’t have access to your Mac, call your Internet Service Provider for assistance in walking you through the steps on how to reset your router back to factory defaults.
Best of luck,