How can I change my name using command blocks?
Solution 1:
There is no command to change a player's name.
As a workaround, you could fake it by hiding the player's name whilst teleporting a named entity onto them.
To hide a player's name tag, put them on a separate team and change the nametagVisibility
option:
/team add HerobrineTeam
/team modify HerobrineTeam nametagVisibility never
Then summon a named entity, such as a marker armorstand:
/summon armor_stand ~ ~ ~ {CustomName:'"Herobrine"',CustomNameVisible:1b,Marker:1b,Invisible:1b}
You can teleport that entity to the player on a clock with something like:
/execute at @p[team=HerobrineTeam] run tp @e[type=armor_stand,name=Herobrine] ~ ~1.7 ~