How to Remove Your User Account from an Xbox One
If you signed in into your friend's Xbox One with your Microsoft account but you are finished playing together, you may want to remove your account before leaving so that your account is not accessed by others. Luckily, Xbox One provides a simple method for removing yourself from any console where you signed in. Here's how it works:
Start the Xbox One console and sign in.
Sign in with the Microsoft account you want to remove from that console.
Go to Settings and select Sign-in, security & passkey.
Here you will find all the settings related to signing in to the Xbox One.
Go to the Sign-in & security section.
Once there, select Remove me from this Xbox.
Confirm that you want your account removed.
Xbox One asks you to confirm that you truly want your account to be removed and informs you on the effects of this decision.
Read the information displayed and select Remove my account.
You are now signed out from the Xbox One and your Microsoft account and all its data is removed from it.