That depends on which password you're referring to. If you are talking about your screen lock password, then yes a factory reset will erase it... Along with everything else on your phone. The caveat is you will need your Google account info to set it back up. This is part of Google's factory reset protection to prevent thieves from accessing the phone's data. If you do not remember that password, then you are out of luck. This is a security feature that can not be bypassed.
If you have trouble remembering passwords, then going forward I'd recommend a password manager (I personally use Last Pass). Or at the very least, write the important ones down and hide them in a drawer at home or something.