If you ever lose your Apple ID account password, you can recover it using one of three methods Apple provides. By default you can use their recovery service which could take a lot of time. But you can set a Recovery Contact to let a trusted person help you recover your account, or you can set a Recovery Key as the ultimate secure method of recovering your account.
Here are the links mentioned in this post:
If you forgot your Apple ID password – https://support.apple.com//HT201487
Having trouble signing in? – https://iforgot.apple.com
Set up an account recovery contact – https://support.apple.com//HT212513How to use account recovery when you can’t reset your Apple ID password – https://support.apple.com//HT204921
Help a friend or family member as their account recovery contact – https://support.apple.com//HT212515
How to generate a recovery key – https://support.apple.com/en-us/HT208072