All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Indeed, you did well by leaving your job that involves forbidden matters like Riba (interest and/or usury), commercial insurance and the like, because the sin of those transactions does not only fall on the person who undertakes them, but it also includes the one who writes it as the Prophet said: “Allaah has cursed the one who consumes Riba (i.e. usury or interest), the one who gives it to others, the one who records it and the one who witnesses it (its transaction).” He said: “All of them are equal in sin.” [Muslim]
As regards mixing between sexes at the work place and at schools and so forth without abiding by the Sharee’ah conditions that man and woman have to follow while dealing with each other, then this is evil, but if a person does not find a way to earn his daily bread and fulfill his necessities except by working at a mixed place, then he should abide by the Sharee’ah conditions when dealing with women and when being with them, like lowering his gaze, avoiding being in forbidden seclusion with one of them, and the like, and he should enjoin good and forbid evil according to his ability as Allaah does not burden a soul more than it can bear.
Moreover, there is no doubt that working as a teacher in a mixed environment is of lesser evil than your previous work where the Riba-based contracts are signed and approved, along with mixing in offices.
As regards investing money in business that will bring profits, then this is among the means of permissible investment and there is a blessing and provision (from Allaah) in trade, especially if the tradesman is truthful and avoids forbidden matters.
Finally, you should remember that whoever abandons something for the Sake of Allaah, Allaah will compensate him with something better.
Allaah Knows best.