The cause lies in the different syntax of both examples:
Where am I?
This is a simple main clause which comes in the form of a question. Therefore its word order differs from that of normal positive sentences: the predicate is moved in front of the subject to mark the sentence as a question.
Positive statement: You_[Subject] are_[Predicate] here_[Prepositional Object].
Question: Where_[Question word] am_[Predicate] I_[Subject]?
Now let's come to your second example, which is yet another question. Again, let's compare it to a positive statement like above:
Positive statement: I know **where I am.
Question: Do you know where I am?
This time, we have a main clause and an (interrogative) clause, which is highlighted in bold print. As you can see, the subject-predicate-inversion to mark the question only happens in the main clause while the subordinate clause remains unchanged:
Positive statement: I_[Subject] know_[Predicate] where I am_[Object].
Question: Do_[Predicate1] you_[Subject] know_[Predicate2] where I am?_[Object]
So there you have it: Example 1 is just a main clause, which is why the word order is changed when forming a question. Example 2 is a combination of main clause and subordinate clause, so the word order only changes in the main clause to mark the sentence as a question.