Why いた is used instead of いる in the dialogue below?
なんで生きてたのか ー＞ Why you lived (~after a fight)? (~ How did you survived?)
なんで生きているのかー＞ Why you still living? (~ How come you are still alive?)
Your confusion is caused by this:
てた・ていた are both the same, the former being a different way to speak it.
（Compare to English wanna＝want to・don't=do not）