Z axis not responding, unless switched with X axis wiring

Here are some things that will cause a newly built machine to fail to perform to expectations. Read through this thread to get a feel for what you need to look for when starting up a new machine.

To your direct question I would think that a careful review of the wiring might solve your problem. If not, ask more questions.