Possible scenario:
A depressed teenager who is tired of being bullied/failing at everything/feels completely alone/insert reason to be depressed about school here does not want to go to school, but has to by law. This means facing whatever has been causing his depression is getting to him.
He hears about all of the shootings that the media has been focused on, and he snaps. He grabs his father's/brother's/mother's/sister's gun and conceals it, intending to make a mark before dying.
The reality? I don't know. There's many reasons he could've done this, and until someone starts talking about his life and what it's like at that school, we won't know.