If you're stretching to the point of pain, that's not a good thing. It sounds like your gym teacher needs to remember that there are varying levels of flexibility, and in pushing that limit you're more likely to injure yourself and your muscles will never relax to the point where they actually stretch and increase your overall flexibility.
Stretches should be to the point that you can feel the stretch, but there's no pain. Stay in that position and breath two or three times, then deepen the stretch if you feel able. If it hurts, back off. Try working on stretches once or twice a day at home in addition to those you have to do in gym, which may help speed up the rate at which you can increase your flexibility. If possible, talk to your gym teacher about your range of motion -- he or she SHOULD know that they're asking you to go beyond a safe stretch, but if they don't listen then there's not a lot else you can do other than work on stretches at home to get to that point faster and hopefully avoid an injury.