I know this is an old post but I was having the same problem and never found the proper solution online, eventually I was able to figure it out so I'm going to share it in case anyone needs it. Retargeting bad joints onto a well-oriented rig with the Character Definition Tag, and then baking the animation solved this for me. More in depth:
As already mentioned in the comments above, the problem is that the joints in the two rigs are oriented differently due to different programs' algorhythms that work in different ways when exporting the rig. To check if it's the case rewind both your rigs to the initial T-pose (if they have one, if not, you can try to put the rig in a T-pose manually and keyframe it) and put them next to each other. If selected, each joint should have a small gizmo indicating its orientation. If at least one of your rigs is good, when you select all of its joints you should see that their orientation matches the axis orientation of the scene (displayed in the top-right corner of the viewport) - meaning that the Y (green) should point up, X (red) to the right and Z (blue) towards the back. It should be like this for every joint. If it's not the case - that rig is the problem. To solve this try the retargeting technique:
Assuming you have at least one rig with joints that are correctly oriented, rewind it to the T-pose and delete the rest of the animation (or just Right Click on it in the Object Manager > Current State To Object, then delete the rig with the animation). If you don't have a good rig - just download a rig in a T-pose from Mixamo and use that as your starting point. Then, retarget your poorly-oriented-rig animation onto the fresh T-posed one. You can find plenty of tutorials on retargeting with the Character Definition Tag, I believe the video above shows how to do it.. but briefly - apply the Character Definition Tag to the Hip bone of the first rig, in the attributes click open manager > extract bones. Repeat with the other rig. Click on the tag of the correctly-oriented rig, in the attributes click create solver, and drag&drop the character definition tag of the poorly-oriented rig into "Source Character" in the attributes.
The concept is that retargeting bad joints onto well-oriented ones, and then baking the animation solves the problem. To bake after retargeting select the Hip bone of the correct rig, Open the Timeline, Go to Functions > Bake Animation > uncheck "create copy" + Ok. Then delete the poorly-oriented animation).