From the IMDb - Trivia:
According to Will Smith in an interview, the reason for his character being named "Will Smith" was that, during the creation of the show, he and Alfonso Ribeiro were brainstorming names for their characters.
Alfonso remarked that Will had to be careful in naming his character, as people would refer to him in public by that name for the rest of his life, and suggested that he name the character "Will Smith".
Will Smith's character name in the show is actually different than in real life. In the show, he is "William" Smith, in real life he's "Willard" Smith. This is referred to when one of Will's girlfriend's father calls him Williard as a joke.
Here is the video interview where he reveals that Alfonso Ribeiro suggested the name "Will Smith"