He said, “Why had he visited his uncle yesterday?”

He said, “Why had he visited his uncle yesterday?”

Explanation
If the Reported speech is in the Past Perfect tense, the Indirect Speech will also remain in the Past perfect tense and the helping verbs will also not change, it means when we convert the Direct Speech of the Past perfect tense to Indirect (reported) Speech the tense of the sentence will change into the Past perfect tense which means no changes to the tense and helping verb.