The question has some possible typing errors that make it hard to know exactly what the given example is saying. But the main question is clear and reasonable:
When we report a sentence containing direct speech, does it change its meaning?
(And by implication, how can we avoid that?)
The short answer is, it may well do, so we need to be aware of that issue. However there are various ways to handle it. There are so many different cases that the following is just a starting example to illustrate the principle.
The (slightly edited) sentence from the OP is:
Tom said, "He did it when she arrived." (direct speech)
When converted to indirect speech it might read:
Tom said he had done it when she arrived. (indirect speech)
And now we have a problem with the pronoun. He in the direct speech is clearly someone other than Tom. But in the indirect speech the sentence by itself leads us to think Tom did it. So we would have to make enough of a change to retain the same essential meaning:
Tom said that Joe had done it when she arrived. (I'm imagining a context here that lets us know who the other guy is.)
Tom said that the other person had done it when she arrived. (If we don't have a name.)
The point here is that reported speech changes the style of the writing but ideally it won't change the content of the story. It's okay to alter the way the story is reported in order to communicate the essential meaning.
Regarding the tenses, we have the same potential problem:
Tom said, "He did it when she arrived." (This implies the doing and arriving happened at the same time.)
Tom said that Joe had done it when she arrived. (This is ambiguous. The doing now could be before or at the same time as the arriving.)
So if it's important to keep the same timing as the direct speech, I would simply say:
Tom said that Joe did it when she arrived.
I suspect the perfect tense is used here because of the (wrong) idea that the tenses have to be back shifted. The perfect tense can be used, but if it risks changing the intended meaning, just use another tense. No tense has to be applied religiously, and the simple past/present/future pattern is often good enough.