To change your username:
1. Open your profile by clicking on your profile picture.
2. Once on your profile page, click on the pencil icon.
Your username can only be changed once! If you want to change it again, select the "Buy a name change" button. It could be purchased for gems.

Please note that you don't need to change the name immediately after the change name purchase.