This is more than just a problem with getting a verification code. Because you have forgotten the password you are being asked by Apple to prove that you have information about the account verifying you are the owner of that account. See if there is an options button letting you try a different method. If you cannot get one to work then you will have to try Account Recovery.
This Apple article has instructions for what to do if you have forgotten your Apple account password, or the system does not recognize the one you remember —> https://support.apple.com/HT201487 or go directly to this link —> http://iforgot.apple.com/
If you find you can’t sign in, reset your password, or receive verification codes, you can request account recovery (read this support article: https://support.apple.com/kb/HT204921 ) to regain access to your account. Account recovery might take a few days or longer, depending on the specific account information you can provide to verify your identity. This is a multi-step process. More detail in —> https://discussions.apple.com/thread/255401538?answerId=260044580022#260044580022 and https://discussions.apple.com/thread/255733423
This page has telephone numbers for contacting Apple for support and service ➞ https://support.apple.com/106932