He asked her why she was learning English. This one is definitely correct - it's an example of reported speech so it's not a real question. Therefore the word order is like a sentence, not a question.
It was why she was learning English. This one is ambiguous - when you say "