If you have two-factor authentication and you get this message when trying to set up your office 365 email account within outlook then here is the fix (it is likely a stored password or app password issue)
First off, the reason this happens is that Outlook likely has your password stored in credential manager, and when you try to set up your outlook profile, it is supplying your stored credentials rather than letting you type them in.
The other issue could be that you have an old version of Outlook that doesn’t support 2-factor authentication and wants an APP PASSWORD
How to fix the Outlook couldn’t set up your account error
Login to Office.com with your email address
Click on your initials on the top right corner and select VIEW ACCOUNT
Under Security Info click on Update Info
Click on ADD METHOD and choose the dropdown and select APP PASSWORD and select ADD
Enter whatever you want for the app password name and then click NEXT
Copy the Password listed there and enter that when Outlook asks for your password (and make sure to select REMEMBER PASSWORD)
If you try to set up an Outlook account and it doesn’t ask you for a password and it keeps saying “Something went wrong” then go to the CONTROL PANEL in Windows and select CREDENTIAL MANAGER
Go to Windows Credentials and delete all the Office.com, Office 365, MicrosoftOffice and Outlook passwords related to your email address
Now go to the Control Panel in Windows and click on MAIL, click SHOW PROFILES and then ADD.
Name the profile anything you would like and then go through the process up adding your email address and THEN WHEN IT ASKS FOR YOUR PASSWORD USE THE APP PASSWORD FROM STEP 6
Your Outlook should now be all set up with O365