You can change the nickname for free once. Go to the Settings > Profile > Change Username.
For subsequent changes you have to activate a Name Changer for 20 Gems in the Shop > Gem Shop. Once the action is confirmed, you will have to enter your preferred nickname in the appeared window.
The nicknames are unique. If a preferred nickname is already registered, please choose another one.