Word order differs between questions and subordinate clauses (i.e. sentences beginning like “the place where …”, “the time when …”, “the man who …”). Clauses beginning with “why”, “where”, “when”, etc., are often misleading because they look like questions but aren’t.
The rule here is that word order in subordinate clauses is exactly the same as in ordinary (non-question) sentences, e.g.:
I don’t know why someone is doing something.
(notice that “does” and “is doing” comes after “someone”). For example:
The same would happen in a question:
But isn’t word order different in questions? Yes, but the question is “Do you know …?”. The part “why she did it” is a subordinate clause, no matter what comes before it. People tend to make mistakes especially after “who” and “what”:
The structure is slightly different if there is no subject in the subordinate clause, i.e. when we actually ask about the subject: