=I didn’t realize how interesting programming was until my teacher taught me.
教える is a transitive verb. So why is に used over が?
I didn't find my issue in Q: Distinction of using を/に instead of が
Japanese Language Stack Exchange is a question and answer site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language. It only takes a minute to sign up.Sign up to join this community
教えていただく means to have someone teach you. It is the honorific equivalent to おしえてもらう.
もらう means to receive something from somebody, and the person who gives it to you is marked by に.
e.g. お母さんにリンゴをもらった I got an apple from mum
When an action/favour is received, the same concept applies and the person from whom you receive the favour is marked with に
e.g. お母さんにリンゴを買ってもらった I got mum to buy an apple for me
いただく works the same way in your example, except that it is honorific （尊敬語）because it is speaking about the teacher doing something for you.
If you use the verb くれる (or くださる in honorific speech) instead, then it means someone gives you something, rather than you receive something from someone. When expressing favours in Japanese, くれる usually means that the person did this without being asked whereas もらう means that you asked them as a favour. Therefore, that person becomes the agent marked by が
e.g. お母さんがリンゴを買ってくれた Mum bought me an apple