Related article: "This PC isn't joined to a domain" error
1. Disconnect and reconnect your Microsoft 365 account. Go through the computer Start menu - Settings - Accounts - Access work or school - highlight your Microsoft 365 account - Disconnect. Then reconnect by going through +Connect, and enter e-mail address and password to log in.
2. The issue may be caused by corrupted user credentials so you can go to the Credential Manager to remove them completely:
Go to Control Panel - User Accounts - Credential Manager, select Windows Credentials - Find the Office related entries and remove them all.
Open a new Word document, enter the account and password, and check if the problem persists.
If the problem still occurs, try repairing Office from Control Panel - Programs and Features.
Some of the information used in this article was taken from the following link: