See this information on two-factor authentication. See especially the bold italics below and the account recovery section.
Two-factor authentication for Apple ID https://support.apple.com/en-us/HT204915 See this section especially Set
up two-factor authentication for your Apple ID. From this section, "Two-factor authentication is available for Apple ID accounts with at least one device that's using the latest iOS, iPadOS, or macOS. Learn more. You can follow these steps on your iPhone, iPad, or iPod touch to turn on two-factor authentication."
See Get a verification code and sign in with two-factor authentication https://support.apple.com/en-us/HT204974 Below is an excerpt, but read the whole document. See the bold italicsbelow.
“Whenever you sign in with your Apple ID on a new device or browser, you'll confirm your identity with your password plus a six-digit verification code. There are a few ways you can get a verification code. You can use the code displayed on your trusted device, get a text or phone call, or generate a code from your trusted device [see the additional information in the article].” A trusted device is an iPhone, iPad, or iPod Touch with iOS 9 and later or a Mac with OS X El Capitan and later that you've already signed into using two-factor authentication.
Account Recovery (from embedded links related to the above links)
“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. “After you request account recovery, you'll get an email with a confirmation of your request and the date and time of when you can expect to regain access.” … When the wait period is over, Apple sends you a text or automated phone call with instructions to regain access to your account. Follow the instructions to immediately regain access to your Apple ID.”
Before beginning account recovery see:
If you didn't receive your verification or reset email https://support.apple.com/en-us/HT201455
“Not sure where that email was sent? Here are some tips to help you find it.”