There is a great way to show that the Lagrangian (the thing you want to minimize) is actually equal to $T-V$. The "proof" comes from the book "Quantum Field Theory for Amateurs". To begin the proof we first of all should consider what the average kinetic and potential energy is as a functional $$T_{avg}[x(t)]=\frac{1}{t_2 -t_1}\int_{t_i}^{t_f}dt \frac{1}{2}m\dot{x}^2(t)$$ $$V_{avg}[x(t)]=\frac{1}{t_2 -t_1}\int_{t_i}^{t_f}dtV(x(t))$$ Next if we take functional derivatives of both sides we find that $$\frac{\delta T_{avg}}{\delta x(t)}=-\frac{1}{t_2 -t_1}m\ddot{x}$$ $$\frac{\delta V_{avg}}{\delta x(t)}=\frac{1}{t_2 -t_1}\frac{dV(x)}{dx}$$ The equations of motion for a object in newtonian mechanics is given by the following equation $$F=-\frac{dV(x)}{dx}$$ However we can also write this equation as $$m\ddot{x}=-\frac{dV(x)}{dx}$$ If we now impose that the equations of motion are satisfied we can substitute the expression we have above into our functional derivative $$\frac{\delta V_{avg}}{\delta x(t)}=-\frac{1}{t_2 -t_1}m\ddot{x}$$ Which is the same the functional derivative of the average kinetic energy. Which means that $$\frac{\delta T_{avg}}{\delta x(t)}=\frac{\delta V_{avg}}{\delta x(t)}$$ Moving the terms to one side gives us $$\frac{\delta T_{avg}}{\delta x(t)}-\frac{\delta V_{avg}}{\delta x(t)}=0$$ Since the functional derivative is linear we see that the following is also true $$\frac{\delta}{\delta x(t)}\left(T_{avg} - V_{avg}\right)=0$$ Now if we substitute the average kinetic energy and the average potential energy back into the equation we see that the following is true $$\frac{\delta}{\delta x(t)}\frac{1}{t_2 -t_1}\int_{t_i}^{t_f}dt \left( \frac{1}{2}m\dot{x}^2(t) - V(x)\right)=0$$ If we make this expression nicer by multiplying through by the constant term we see that $$\frac{\delta}{\delta x(t)}\int_{t_i}^{t_f}dt \left( \frac{1}{2}m\dot{x}^2(t) - V(x)\right)=0$$ Which is the same as $$\frac{\delta}{\delta x(t)}\int_{t_i}^{t_f}dt \left( T - V\right)=0$$ We can see here that we are minimising this functional and this functional leads to the equations of motions because we imposed it into our definition. This is what the action is and the term inside the action is the lagrangian. So we have shown that $$L = T - V$$