The faster Pokemon moves first. MegaZard X has higher Speed than Mega TTar, so usually MegaZard X will move first. However, if you have no Speed investment and TTar has lots of Speed investment, it could move first. However, a Speed-invested TTar is very rare.
MegaZard X can't really do a whole lot against Mega Tyranitar, especially in a sandstorm. There aren't any super-effective moves that MegaZard X can use against TTar except Earthquake, and you don't get the Tough Claws boost on it. If you run a bulky MegaZard X you might be able to take more Stone Edges, but your Earthquakes against TTar will be weaker. It also depends on how the TTar is trained compared to how your MegaZard is trained. Whether they're both bulky, or whether one is bulky and the other is offensive plays into who wins. Also Stone Edge has poor accuracy, but Earthquake doesn't. Part of it is up to luck.