If you still couldn't recall your Mac password with the password hint, continue to type a random password three times. If you have set a password hint, you can click the question mark on the login screen to get some help.
Thus, before seeking ways to recover your password or resetting it, go to check if there's an error in your password typing. What is worth mention, sometimes, you haven't forgotten your Mac password actually but typed the wrong one, like mistyping the uppercase or lowercase characters. Necessary checks before resetting your Mac password Use an admin account to reset the Mac password Reset your Mac password in macOS Recovery mode Reset your Mac password with a FileVault Recovery Key Here are the ways to reset your Mac password (login password), which are suitable for all Mac models, like M1 MacBook Air, M1 MacBook Pro, M1 Mac mini, MacBook Pro, MacBook Air. You can reset your login password or use other available accounts or keys to open your Mac desktop again.
There still have ways to unlock your Mac as Mac supplies some built-in utilities as remedial measures. But the sad thing happened that you've forgotten your login or admin password on Mac like M1 MacBook Air. Like a key to a door, your Mac password lets your access your Mac every time you type it correctly.