In addition to Invoker's answer, the context of the conversation also influences whether you use my or our.
If you are speaking to someone who shares your teacher, you would use our. For example:
Did you enjoy today's lecture? I thought our teacher did a good job.
In this context, it is not semantically correct to use my, as it implies that your classmate does not actually have the same teacher as you, which is false.
If you are speaking to someone not in your class, you would typically use my. For example:
What happened at school today? My class's teacher gave a lecture to the entire student body.
Here, using my is technically semantically more correct. However, using our is acceptable, because it's understood that our is used to convey membership in a larger group (the class) rather than meaning that the listener also shares your teacher.
Finally, note the slight changes I have made to the phrase in question: our teacher and my class's teacher. These are American English idiomatic phrasings. Class is omitted because it's understood, or changed to the possessive because that's simply the construction of choice. In the latter case, the emphasis is on class, which has a teacher, hence the possessive. Class teacher is both perfectly grammatical and the idiomatic phrasing of choice in British English.