An alter ego serves many different purposes. First, it allows a person (not specifically only authors) to escape form reality. Another purpose of the alter ego is to allow a person to find them self as defined by their own terms, definitions, characteristics, and stereotypical thoughts.
In regards to Laurie, in Jackson's short story "Charles," Laurie's creation of an alter ego may function in both of the ways described above.
First, Laurie may be wanting to escape from the fact that it is he who is behaving badly in school. He may be fearful of the punishment which surely awaits if his parents find out that "Charles" is him. Second, Laurie may be feeling out his parents and how they would react if they did know that "Charles" was Laurie.
Second, Laurie may be trying to find himself as a gender specific person. The name Laurie is typically reserved for girls/women, not boys. Laurie may be struggling with the fact, even as young as he is, that his name has misidentified him. He is not a girl. Unfortunately, some may have assumed this. One can almost picture the teacher calling Laurie's name on the first day of school and being caught off guard when a boy raises his hand. She may have even stated that she thought he was a girl.
Therefore, to negate any other mistakes, Laurie's alter ego assumes the name Charles. There is simply no way that a person could not know that a name Charles is a boy's name.