In your context, I don't see the need for a preposition.
After classes, I go to the gym.
After classes, I stay at university to use the gym.
For me, if you "stay on after class", it means you remain in the classroom and do some more study. It can also be a punishment, like detention. The teacher might tell you that you must "stay on after class" if you've been naughty (I don't think this happens at university!)