It's a sad feature if Mail on Macs.
Open Keychain Access in Utilities, then either check the Password under that item, change it, or delete it and start over.
Enter the part after the @sign in the search bar.
You may have duplicate or more entries in Keychain Access.
If using a browser to login via WebMail works it's not Name or Password, but likely old passwords interfering.
There''ll be at least 2 entries, maybe more.
The trouble is that Mac Mail almost always chooses the old Passwords if you don't change or get rid of the old ones.
Restart to clear some caches.
The big bugaboo with Mail is finding the keychain for any auto setup Mail accounts, if IMAP it usually involves deleting the account & setting it up again to fix it.