Explanation
"I asked who had done it."
The original sentence is a direct question in past tense ("Who did it?").
In reported speech:
The reporting verb "said" changes to "asked" (as it's a question)
The past simple "did" changes to past perfect "had done" (standard tense change in reported speech)
The question structure changes to indirect statement structure (no question mark needed)
The word order changes from question form to statement form