My 2cents worth, I fully agree with what Steve has stated, in that both the X Axis steppers are feed from one driver and plug.
So you would think that the problem you have described should be wiring related. You have checked and tested the wiring to be correct!
So for me I would now look at one of the two stepper motors as being the issue.
I would take the tooth belt off both of these motors, by sliding the pulley off the shafts. Put a piece of coloured tape around the two x axis stepper motor shafts. This is so you can see in which direction the motors are turning.
Looking from over one side of the machine over the two X axis motors, run some test and take not that the motors from where you stand should turn in the same direction. Keep on testing until you see the problem you are having. Meaning that either the front or back motor starts the turn in the opposite direction. Make sure that you have everything connected including the end stops, as this may or may not have induced the problem.
I would have the Z motor handy to use as a test replacement, for a possible faulty X axis motor. Once you see the problem again and have establishes which motor changes direction, replace that motor with the Z motor. Run some more tests and if you do not see the issue again the problem was in the stepper motor that you had taken out.
All mechanical and electrical problems are best solved by the process of elimination. If the above does not give you any position resolve to the issue we can take it further.
But for now lets try the above.