The correct answer is: A. who he was and why he was
The sentence is in the past tense, so the verb "to be" should be conjugated in the past tense as well. The past tense of "to be" is "was."
The intruder is a stranger, so the teacher does not know his name. The teacher asks the intruder who he is, which means "what is your name?"
The intruder is also occupying the teacher's chair, which is a problem. The teacher asks the intruder why he is occupying his chair, which means "what are you doing in my chair?"
The sentence is grammatically correct and makes sense.
Option B is incorrect because the verb "to be" is conjugated in the present tense. The sentence should be in the past tense because it is about something that happened in the past.
Option C is incorrect because the verb "to be" is conjugated in the past perfect tense. The past perfect tense is used to talk about something that happened before another event in the past. In this sentence, there is no other event in the past that the intruder's identity or his occupation of the chair happened before.
Option D is incorrect because the sentence is already grammatically correct and makes sense.