"Going here"
In this context, "he wasn't going here" doesn't make any sense, and is incorrect. Going is the verb in that phrase, which means moving from place to place. But if he is moving to "here" then he's "COMING here" not "GOING here."
Presence, being somewhere
On the other hand, BE is the verb of presence at a place. If you will be present "here" then you're "going to BE here," or you're "about to BE here" or you "will BE here." It has alternate forms, of course, including WAS in past tense. All of these would make perfect sense for the same meaning in a conversation:
- known that he wasn't GOING TO BE here
- known that he WASN'T here
- known that he wouldn't BE here
- known that he wasn't COMING here
- known that he wasn't GOING TO COME here
- known that he wouldn't COME here
#4 #5 and #6 all share a different literal meaning because the verb is a form of "go" instead of a form of "be." All six make conversational sense and have the same outcome: he was not there. I include #4 #5 and #6 because of the objectively wrong "going here" in your teacher's answer, which would be fine as "coming here." #6 is a little awkward on its own, but if there's a time phrase after, then it makes more conversational sense, like "wouldn't come here after school."
Despite any word limit, "he wasn't going here" is incorrect to indicate his absence from "here."
Known "that"
"That" is used to specify the phrase following it as the object of "known" (what was to be known?). This is only important if leaving it out changes the meaning or causes confusion. In this case, either using "that" or leaving it out doesn't change the meaning. "What was to be known" in both cases is "he wasn't here." But if the teacher says it's needed, you'll probably be best to use it.
In conversation, these have the same meaning:
- If I had known that he wasn't here, I would have stayed home.
- If I had known he wasn't here, I would have stayed home.
Here's more on "that" (link) - when "that" is needed, and when it's not.