If you have forgotten your Mac login password, you can reset it by entering a password up to three times until you see one of the password-reset options. If you choose to reset using your Apple ID, you will need to restart your Mac and enter your new password information, or use your recovery key. If you can't reset your password, you can contact Apple Support for assistance.
If you forgot your Mac login password - Apple Support
Before you begin. First try the standard steps to reset your Mac login password.
Start up from macOS Recovery. Determine whether you're using a Mac with Apple silicon, then follow the appropriate steps to start up from macOS Recovery
If you're asked to select an admin user. If you're asked to select an admin user you know the password for, click “Forgot all passwords?” and proceed as described below.
Use the Reset Password assistant. You should now see the utilities window, which shows options such as restoring from Time Machine, reinstalling macOS, and using Disk Utility.
If you can't reset your Mac login password - Apple Support