I'm tying to understand, historically, what lead to Lagrangian mechanics (LM). What did Lagrange actually do?
In the time (year 1788), when Lagrange published his work (that we nowadays call "Lagrangian mechanics") the term "energy" was not known. It slowly developed in the next 60 years after Lagrange's work. However, in modern times we say that $L = T - V$ is the difference between two energies, then do some derivation magic and get equations of motions for particles (or density fields).
Today, LM is also often introduced in a way that claims that Newton laws are not optimal because they are so hard to solve because Newton did not know about "generalized coordinates". But surely Isaac Newton was smart enough to express $x = r \sin(\phi)$ or something similar in his times already. So, this approach to introduce LM also only fits if you already know the result of LM. (And even if Newton really did not know to use other coordinates than $x$, $y$ and $z$: you still can do this, today, without using LM explicitly)
So, what did Lagrange actually do in his original works? What problem did he tried to solve? And what did he call his resulting variables, if not "energy"?