Hard to tell without details but it sounds a bit like a local vs world space issue:

This cube is facing to the left. When I need to rotate it, I can either use its local axis or world axis - as seen in the transform gizmo.
You could get 2 very different results here depending which red X forward we rotate about.
Same can be achieved (and messed up!) with scripting.