Go to Settings > Accounts > Your info, then select Sign in with a local account instead and follow the steps - this removes your Microsoft account from Windows 11 easily.
To remove a Microsoft account from Windows 11, go to Settings > Accounts > Email & accounts, select the Microsoft account you want to remove, click Remove, and confirm. Make sure another local or admin account is available before doing this.
In Windows 11, it is possible to get rid of a Microsoft account by initially switching over to a local user account and afterward deleting the old account if it is not the main one. If the account in question is for a secondary user, you have the option to remove it straight away without any switching.
Go to Settings > Accounts > Your info, select Sign in with a local account instead, follow the steps, then go to Settings > Accounts > Email & accounts and remove the Microsoft account.