It all depends on a few factors:
1. What the character would introduce themselves as to other characters. If their friends just call the character that while he goes off and introduces himself to new people as something else, you'd want to just have his friends refer to him as that nickname and refer to the character in the narration by whatever his real name is (or at least whatever he introduces himself as). If he prefers to use his nickname, you might as well use his nickname.
Obligatory fangirl example the first: Bill's real name is obviously William, but almost everyone calls him Bill. Technically, my headcanon says he doesn't actually care how people refer to him (either by William or his nickname), but he introduces himself as Bill because he personally prefers to refer to himself as that over his legal name. Hence, the narration calls him Bill and not William because the latter is almost never used, even by Bill himself.
2. What you want to do. Occasionally, even if a character prefers his real name over his nickname, the narration ends up referring to him by the nickname for plot reasons.
Obligatory fangirl example the second: In Anansi Boys, we're introduced to a character whose real name is Charles. He prefers that name and introduces himself to everyone as that, but everyone (including the third-person narrator) refers to him as Charlie or Fat Charlie. This is because his father gave him the name as a child to tease him, and the name stuck... because his father happened to be a very charismatic god. Hence, the narration ends up referring to Charles as Charlie as a way of saying that his father was that influential and as a way of building the kind of tone you just see throughout the book.
As a note, the reverse is also true. Sometimes, no matter how much a character tries to get people to call him by a nickname, the narration ends up calling him by his real name or something else, also usually to build the tone or say something about the character.
3. How many names this character says he has. Sometimes, the character is introduced with one identity -- be it real or fake -- and is referred to as that because the names he gives other characters (or the names the other characters give him) keeps changing.
I really can't think off the top of my head a suitable example, but the closest might be {...} in Hanna Is Not a Boy's Name.
And there's probably other factors, but I'm too out-of-it to come up with decent examples. So, long story short, personally? I just go with however I introduce them. It just depends on the circumstances.