Hi! The issue is usually authentication, not the mail server names themselves. Google no longer allows old-style basic username/password sign-ins for Gmail with POP/IMAP in the same way as before, except in limited cases where an app password is used and app passwords are only available if 2-Step Verification is turned on, and they are typically only needed when the app doesn’t offer “Sign in with Google.”
Open Credential Manager in Windows and remove the Gmail-related entries that start with MicrosoftOffice16_Data:OAUTH2, then try adding the account again and make sure to allow Microsoft access during the browser sign-in.
If this doesn't work, you need to make some changes to your security on the Gmail side.