X and Y axis strange motor behavior

You should home all of the axis first.
If any move away from the end stop check the end stop wiring for that axis