Hello,
This sounds like Two-factor Authentication. You can either receive codes from a trusted device or at a trusted number. Do you have any other Apple devices already signed in with your Apple ID? If so you can get a code from one of them.
Get a verification code and sign in with two-factor authentication - Apple Support
"Use the code displayed on your trusted device
If you have a trusted device running iOSĀ 9 and later, OSĀ XĀ ElĀ Capitan and later, iPadOS 13 and later,Ā or watchOS 6 and later, the verification code is displayed automatically on your trusted devices.
- Sign in with your Apple ID and password on a new device or browser.
- Look for a sign in notification on any of your trusted devices.
- Tap Allow to receiveĀ yourĀ verification code.
- Enter the verification code on your other device to complete sign in."
If you don't have any other device you may need to try the account recovery option.
"If you still can't sign in
If you canāt sign in, reset your password, or receive verification codes, you canĀ request account recovery 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."
I hope this helps.