If the Mac has the T2 Security Chip (or possibly M1 as well), the Mac will stop accepting passwords after 30 failed password attempts.
At that point, 10 additional attempts are available through macOS Recovery.
If those 10 attempts are failed as well, then one of the below applies:
If FileVault is ON: Each recovery method has 30 attempts before it gets locked out. This could be an iCloud recovery key, a personal recovery key (the usual kind you get if you choose not to store the key in iCloud), or an institutional recovery key. Once all of those attempts are exhausted, the T2 (or possibly M1) chip will stop accepting unlock attempts, and the data is forever lost.
If FileVault is OFF: You can reset your password anytime using the resetpassword command in macOS Recovery.
Source (page 7): https://www.apple.com/ca/mac/docs/Apple_T2_Security_Chip_Overview.pdf