Let me introduce myself.

I am a student of Class 1-5.
I am a student in Class 1-5.
I am a student from class 1-5.

Which expression is grammatical?

The best is the second sentence.

All three expressions are grammatically correct, but they convey slightly different meanings.

1. "I am a student of Class 1-5."
This implies that you are a student who belongs to or is enrolled in a specific class labeled as "Class 1-5." The class could refer to a specific grade level or a grouping of classes, such as five consecutive classes from first grade to fifth grade.

2. "I am a student in Class 1-5."
This suggests that you are currently attending or enrolled in a specific class or group of classes designated as "Class 1-5." It doesn't necessarily imply that you are attending all subjects within that class or level.

3. "I am a student from class 1-5."
This indicates that you previously belonged to or attended a class labeled as "Class 1-5." The "from" implies that you are no longer in that class, either having moved up to a higher class or transferred to a different class or school.

So, depending on the context and the intended meaning, you can use any of the three expressions mentioned above.