I believe that this scene is not what it could be interpreted as. I'm not of the impression that there are any inappropriate activities here.
What I think is happening is, Koito's having a hard time at school (being bullied) and she is confiding in the teacher. (Kids got problems and they talk to their teachers, all normal.)
Ai walks in and sees it happening. At this moment I don't believe she thinks anything inappropriate was going on but it does upset her. And I understand why.
Being someone who has been in a similar scenario as a teen with a friend of 10yrs, I understand how it can make you feel like a terrible friend. Realising that someone you considered your closest friend would prefer to confide in another person ( or in my case a complete stranger) makes you question a lot of things about yourself.
Granted there are many reasons why someone would choose not to confide in a close friend but that's something you figure out as time passes.
But I understand why Ai has resentment towards Koito. I get it.
I still want more info though. What really was going on? What did she tell the teacher? What did Ai do after she saw them?
Only one way to find out.