Basically, the Lagrangian is where T is kinetic energy and V is potential energy (some systems are easier to describe than others). Right off the bat you’ll notice that has no x or y (just z), so if you change the x or y it doesn’t change at all. It turns out that this gives you conservation of momentum in the x and y directions (that’s not obvious, btw). As a result, changing z changes , and you don’t have conservation of momentum in the z direction (up-down direction). The theorem that describes the correspondence between symmetries and conservation laws is “Noether’s theorem“.