X-Ray got his nickname because he wore glasses. He claims he can see through people.
X-Ray wore glasses, which were quite dirty and so thick it seemed to Stanley that he could barely see through them.
“It isn’t just a nickname,” X-Ray told Mr. Pedanski. He tapped the rim of his glasses. “I can see inside you, Mom. ... ” (Ch. 5, p. 18)
At Camp Green Lake, all of the boys have nicknames. Most of them are not very flattering, such as Armpit and Barf Bag. By those standards, X-Ray is actually a very nice nickname. Even the other nicknames are considered good ones by the campers, who use them to resurrect themselves and reaffirm themselves in a place that strips them of their identity.
X-Ray has the coolest nickname because he is kind of in charge. You can tell this from his treatment of things like shovels.
… X-Ray had his own special shovel, which no one else was allowed to use. X-Ray claimed it was shorter than the others, but if it was, it was only by a fraction of an inch. (Ch 7, p. 27)
In a way, X-Ray is able to see inside of people, but not physically. He can read them, and manipulate them. This allows him to keep himself in charge, get them to do things for him, and push them around. He is able to assign people nicknames and institute rules even outside those of the camp, in order to give himself special privileges like those of the shovel. This allows him to get what he wants, when he wants it, from who he wants it. The adults seem to go along with this. He is able to manipulate them too. X-Ray has made the best of a bad situation at Camp Green Lake.