Police got the report of the incident around 10:45 a.m. Chapel Hill only had part day classes Thursday, and that's why the bus was operating so late in the morning.
Officials said the gun was fired as the bus pulled into the high school.
"I was sitting like two seats in front of him. All I heard was a gunshot," recalled 9th grader Phneice Holloman.
Holloman said it appeared the student was taking the gun out of a pocket when it went off.
The school resource officer spotted him as he ran off the bus, through the woods, and into a home on Jubilee Drive, where he later surrendered.
Chapel Hill High and three other nearby schools were put on lockdown as a precaution while police looked for him.
Police arrested 18-year-old Aaron Mario Small just before 11:30 a.m. A .22 caliber revolver was also recovered.
Friends of Small say he was trying to get revenge after losing a fight with a gang member.
"The suspect had kind of lost the fight," one friend said. "So he came back to school with his own weapon and decided to get revenge and shoot back at the student."
"We didn't know when he was going to do it, but he said he was going to do it," another friend said. "That he was going to get revenge."
Nobody on the bus was hurt. For that, the families of all the students on board are grateful.
"I just thank God. I'm just so, so thankful that nothing else happened," said grandmother Cheryl Edwards.
Parents were shocked anything like this could happen in Chapel Hill.
"It's so scary. I mean I see a lot of it happening around the United States and it's very quiet here. It's nice. Especially in this school," offered parent Jesus Perez.
Some parents say they are concerned the school is not doing enough about some recent gang activity.
A Chapel Hill schools spokesperson says they weren't aware of any recent activity, but they say they will be working with police in the coming days to see if they can improve safety at the school in anyway.
Small is charged with possession of a weapon on school property and discharging a weapon on school property. His bond was set at $15,100.