hi, joojei, I think our chinese friends explained the point very well, But perhaps you have still doubts, so I will try to explain it in another manner:
学校 is school, but 校 alone means also school. When you have read 在校学生, you thought perhaps that 校学生 was a single word, and you read: 在 + 校学生。But, in fact, you should have read: 在校 + 学生, which literally means: in the school" + "student". In the school works here as an adjective. So, a possible translation to your sentence could be: "A 21-year old student of the school".
Hope it helps.