Where does Macbook Pro store wifi information? Last December I connected to a wifi network with a password. A couple weeks ago I got a new hard drive for my computer. Today, I reconnected to that wifi network (this is the first time since I changed my hard drive) and my computer automatically connected to it.
I expected the computer to lose network credentials when switching the hard drive, but it did not. Where is network information (such as credentials) stored on a Macbook Pro?
Your Mac also stores the information about Wi-Fi access points it connected to in NVRAM.
From the Apple Support article:

https://support.apple.com/kb/HT204063


NVRAM (nonvolatile random-access memory) is a small amount of memory that your Mac uses to store certain settings and access them quickly.

While iCloud keychain also stores the Wi-Fi access point information, it's tied to a users Apple ID.
So if you are looking for a scenario where you want to give away your Mac to someone else, and do not want the Mac to retain crucial information such as your Wi-Fi access point password, you could, in addition to wiping the hard drive/reinstalling the operating system also take additional steps to reset NVRAM and PRAM on your Mac.
The linked article describes the steps to reset NVRAM and PRAM.

How to reset NVRAM
Option + Command + P + R
Shut down your Mac, then turn it on and immediately press and hold these four keys together: Option, Command, P, and R. You can release the keys after about 20 seconds, during which your Mac might appear to restart.