If your account has no posts, then you can change your username by accessing your account settings and submitting a new name. If you've made at least one post, then you won't be able to change your username freely.
For established users, we run a bi-annual 'name change period', during which anybody can change their name. The site admin Pokemaster will post a thread in the Meta section when the next name change period is approaching. A date will be specified in that thread, and once that date passes, you will be able to edit your username. After some days have gone by, the ability to change usernames will be closed again.
We recommend checking the latest name change thread to learn how this works. You can find all the past name change periods on Pokemaster's question list. As of 2023, name change periods happen every March and September.
We recommend checking Meta's navigation area when the next name change period is due, so you won't miss your chance. Since you will only be able to change your name once every six months, pick a name you will want to keep!