I can see why you'd want to clean your gun in school. If I stretch my imagination. Maybe you're one of those people who are anal. You didn't have time to do it this morning so you brought it along to school, took it to a classroom, spread your stuff around and cleaned it. Decided to take a coffee break and left everything behind, ended up forgetting about it. Maybe. It could happen.
I can even see how someone would do it as a hoax. Maybe to get out of a test, a committee meeting, a conference, a meeting with a particularly obnoxious PI. You bring just the cleaning kit and the empty shell box, arrange it on the desk in one of the classrooms. You sneak away. Someone will eventually find it and there, problem solved.
If I try really hard, I can see someone deciding to kill themselves. You have OCD. You need the gun to be clean before you can use it. So you sneak it into school, find an empty classroom, clean it, leave the cleaning stuff behind (it seems pointless to lug it along with you), find an empty toilet stall, lock yourself in and shoot yourself. Maybe a med student who failed a year.
But I have to actually attempt an out-of-body imaginative exploratory venture to see why someone would want to shoot random people down. You're not happy with your life, so you decide to clean a gun, load it and kill a bunch of people you don't know from Adam? Go figure.