How could he have done such a thing? expresses disbelief and/or shock at a person's actions. It uses the present perfect tense - focusing on the result of something which happened in the past.
How could he do such a thing is also possible, and can be used in a similar manner.
I am not a teacher.
Student or Learner