Open your Xbox profile, choose Customize profile, select the gamertag, type a new one, check that it's available, and confirm. Your first gamertag change is free; every change after that costs a fee (around $10). You can do it on the console, in the Xbox app, or at account.xbox.com.