After more than 15 years covering everything Apple, it’s with a heavy heart we announce that we will no longer be publishing new content on iMore and the iMore forums will be closing as of November 1st, 2024.
Depends on what you mean by "locked with password"... if it's Activation Locked - there's nothing you can do about that other than entering the correct credentials as in the AppleID and Password the device is locked to.
Welcome to iMore! Exactly what @kch50428 said. If the device is actually yours and you know your Apple ID and password, follow the link for more information. https://support.apple.com/en-us/HT204306
If you've forgotten your password you can attempt to reset it at http://iforgot.apple.com.