This question already has an answer here:
I've often heard that every physical theory has some kind of Lagrangian formalism, or a formalism in terms of a principle of stationary action. The Standard Model has one, General Relativity has one, Electromagnetism has one, and so on.
On the surface, these all seem like very different theories. What is it that unifies them so that they all end up having a Lagrangian (or other action-based) formalism? Why should physical laws be expressed in this way?
EDIT: My question has been identified as a possible duplicate of this question. That question specifically asks about quantizing Lagrangian, when is it possible, and how general it is. I'm asking what the salient properties of physical theories are that makes it possible to associate to them a Lagrangian formalism.