When you first start playing Harry Potter: Wizards Unite, you will need to set up all your in-game details. You will be asked to enter your real name and a code name. Your real name will be visible only to you, but it is safe to assume that Niantic, the games developers, will also have access to it. The code name is pretty much your Gamertag and is what will be visible to the rest of the people who play the game.
Who Can See Your Code Name
In Harry Potter: Wizards Unite, nearby players in certain areas will be able to see your code name on the map. Friend requests will be sent and received using code names (so it needs to be unique), and you can track your friends using their code names on the Friends tab.
If you visit a Fortress to take part in some battles, both your code name and your profession will be displayed to other players when you are in the lobby. Your code name will be visible for the entire duration of the challenge.
If you have a Dark Detector, and you use it on an Amplifier at an Inn, your code name will also be displayed. Dark Detectors work just like Lures in Pokemon GO and reveal an increased rate of objects on the map, such as Confoundables.
Remember, your code name will be shown to other players, and in the real world, those players will be able to see who is using what code name, as such, you might want to think when picking one. Niantic has advised for some responsibility when choosing your code name, and they are right to do so.