"I'm at school to study to study something" would mean I'm literally there. "at" symbolizes the location.
"I'm in school to study something" could be used in a conversation with someone to tell them that you're a student.
That's the difference. I don't know if my explanation is clear enough though !