Anyone else curious how he figured that fact out? I'm not sure I want to know.
Idk
Accidentally walked in on him?
He had the keys to that room. Meaning he was in charge of it. That teacher was who probably gave him the keys and probably told him to keep out at that time everyday and he might have just investigated it further to figure it out.