The following answer converges on the same ideas as in the answer by contributor maenju, submitted sept. 23, 2023.
The derivation that I present here is a reworked version of a PSE answer by me to a question about the work-energy theorem, submitted on july 17, 2021.
I will argue the following:
- the concept of energy arises naturally in classical mechanics
- the concept of energy that arises in classical mechanics carries over to all other fields of physics.
In classical mechanics the second most important expression, second only to $F=ma$, is the work-energy theorem. If $F=ma$ is granted as axiom then work-energy follows as theorem.
The starting point:
$$ F = ma \tag{1} $$
The next step is to evaluate an integral: integrate both sides with respect to the position coordinate, integrating from starting point $s_0$ to final point $s$
$$ \int_{s_0}^s F \ ds = \int_{s_0}^s ma \ ds \tag{2} $$
The work-energy theorem hinges on the fact that the two factors in the right hand side of (2), acceleration $a$ and position coordinate $s$, are not independent of each other; acceleration is the second derivative of position.
We proceed to develop the right hand side of (2).
In the steps starting with (5) the integrand $a$ is converted to velocity and the differential $ds$ is converted to $dv$, using the relations (3) and (4)
$$ v = \frac{ds}{dt} \ \Leftrightarrow \ ds = v \ dt \tag{3} $$
$$ a = \frac{dv}{dt} \ \Leftrightarrow \ dv = a \ dt \tag{4} $$
(5) corresponds to the right hand side of (2)
$$ \int_{s_0}^s a \ ds \tag{5} $$
$$ \int_{t_0}^t a \ v \ dt \tag{6} $$
$$ \int_{t_0}^t v \ a \ dt \tag{7} $$
$$ \int_{v_0}^v v \ dv \tag{8} $$
First (3) was used to change the differential from $ds$ to $dt$, with corresponding change of limits. Next (4) was used - with change of limits - to arrive at (8).
So we have the following mathematical relation:
$$ \int_{s_0}^s a \ ds = \tfrac{1}{2}v^2 - \tfrac{1}{2}v_0^2 \tag{9} $$
Notice especially:
The definitions (3) and (4), in combined form, are sufficient to imply (9).
Stated differently: (9) expresses: whenever you have a quantity $s$, its first derivative, and its second derivative, an expression with the form of (9) is valid.
We use (9) to go from (2) to the work-energy theorem:
$$ \int_{s_0}^s F \ ds = \tfrac{1}{2}mv^2 - \tfrac{1}{2}mv_0^2 \tag{10} $$
The concepts of potential energy and kinetic energy exist by virtue of the existence of the work-energy theorem, in the sense that when (10) does not obtain there is no reason to take an energy concept into consideration.
Mathematically the origin of the concept of energy is the act of evaluating an integral. That is why the expression for kinetic energy has that factor $\tfrac{1}{2}$, it stems from evaluation of an integral.
Multiple degrees of freedom
I take it as obvious that the above derivation generalizes to multiple degrees of freedom, be it cartesian coordinates or generalized coordinates.
Kinetic energy: proportional to square of velocity.
Pythagoras' theorem: the square of the resultant is the sum of the squares of the components.
Therefore: with multiple degrees of freedom it is sufficient to use an expression for the resultant kinetic energy. We have that either with one degree of freedom or with multiple degrees of freedom: it is sufficient to express the kinetic energy (at any instant) as a single scalar value.
In contrast with that: when there are multiple degrees of freedom it is necessary that the expressions for the potential cover all degrees of freedom. The force is recovered by evaluating the gradient of the potential.
We always know in which direction an acceleration will be: down the gradient of the potential. That is sufficient.
Sum of potential energy and kinetic energy
The outcome of an integration is inherently an incremental value. As we know: the outcome of an integration does not have an intrinsic zero point; for any potential energy we choose a zero point for it.
The left hand side of (10) is the expression for work done. We have that potential energy is defined as the negative of work done.
Hence:
$$ - \Delta E_p = \Delta E_k \tag{11} $$
Which of course rearranges to:
$$ \Delta E_k + \Delta E_p = 0 \tag{12} $$
This demonstrates:
In and of itself the work-energy theorem is already sufficient to imply that the sum of potential energy and kinetic energy is a constant.
Of course, that should not be blindly generalized to a blanket statement of conservation of any energy.
An example:
Inductance is a phenomenon where a form of kinetic energy is recognized that is distinct from mechanical kinetic energy.
Let there be a coil with significant self-inductance. For simplicity we make the setup superconducting.
We take the position of charge as our state, in such a way that the first derivative of that state is the electric current.
In the absence of an electromotive force the current will continue indefinitely. To change the current strength an electromotive force is required. A change in current strength results in an change of magnetic field that in turn produces an electromotive force that acts in opposition to the change of current strength.
Because of that opposition: the second derivative of the state is proportional to the applied electromotive force.
We have that the relation between second derivative of the state, electromotive force and inductance has the same form as $F=ma$, thus giving rise to a electromagnetic counterpart of the work-energy theorem.
As we know: the recurrent pattern is: in physics taking place energy is conserved.
That observation suggests that all interactions are of a nature such that the second derivative of the state is proportional to the gradient of the potential energy.