Go to the official Minecraft account website
Sign in with your Microsoft account
Open your profile or account settings
Find the username or gamertag section
Select the option to change your username
Enter your new username
Check that the username is available
Save the changes
Wait for the update to apply in Minecraft
Note that username changes may have a cooldown period before you can change it again
