Leon Arreguin was taken into custody Friday for opening fire at a passing car near the school but hitting the girl instead, police said.
She suffered serious but non-life-threatening injuries and was taken to the hospital.
Students had already been dismissed from school at the time of the shooting, officials said.
Arreguin was charged with assault with a firearm, illegal firearm discharge, and inflicting injury on a child, authorities said.
Police did not give an update on the girl's condition.