The Legendre transform is not tethered to classical mechanics, it is just one application of it, another one is to thermodynamics. Geometrically, it is a general way to re-represent convex functions in terms of supporting hyperplanes, and/or to construct convex hulls of general functions. However, Legendre had neither interpretation in mind when he introduced the transform. To him, it was a clever change of variables to improve on Monge's study of Lagrange's minimal surface equation, see Borgato, Gaspard Monge (1746-1818): application of geometry to analysis:
"At the base of these results, there was an attempt by Monge to study the minimal surface equation, an attempt that highlights the merits and defects of his approach to the theory of partial differential equations. The solution provided by Monge was criticized by Legendre who claimed to have been invited by Monge himself to study the issue he was debating with Laplace. According to Legendre, Monge’s
error was due to unclear metaphysical principles on which the mathematicians did not agree. Instead of Monge’s solution, Legendre provided another one by making a very elegant change in the variable (Legendre transformation)."
The paper where Legendre introduced the transform is Mémoire sur l'intégration de quelques équations aux différences partielles: lû le 1er septembre 1787, Histoire de l'Académie Royale de Sciences. Année M. DCCLXXXVII. Avec les Mémoires de Mathématique & de Physique de la meme année, pp. 309–351. A Paris, de l’Imprimerie royale M. DCCLXXXIX, 1789. Kiselman gives the following commentary on Legendre's contribution in Werner Fenchel, a pioneer in convexity theory:
"“Au lieu de considérer $z, p, q$ comme des fonctions de $x$ & $y$, rien n’empêche de regarder $x, y, z$
comme des fonctions de $p$ & $q$; [. . . ]” (p. 315). This is the very beginning of what we now call the Legendre transformation. Here it is about a function $z$
of two variables x and y with $p = \partial z/\partial x$ and $q = \partial z/\partial y$. The symmetry or
duality between $z, p, q$ and $x, y, z$ is evident. Later in the article the author considers functions of more than two variables."
That Hamilton did not link the requisite change of variables to Legendre is not very surprising given the difference of context. Closely related canonical transformations were soon studied by Delaunay, Liouville and Jacobi. Linking it to conjugation of convex functions also took some time. Kiselman gives a translation of Fenchel's 1977 letter to him on transform's history in convex analysis with some interesting remarks on the naming:
"The classical Legendre transformation was introduced purely formally by Legendre. That it is an involution and closely related to duality was, however, as far as I know, first discovered by Monge somewhat later. One shall of course keep the name Legendre transformation... W. H. Young has in a small paper from 1912 proved [his inequality for] a special case of the classical Legendre transformation, which Young, however, did not notice, even though this is clear from his proof. He is only interested in the inequality. The next contribution to the topic is due to Z. W. Birnbaum & W. Orlicz, 1931... Here the “complementary” function $\widetilde{f}$ to $f$ is defined by $\widetilde{f}(y)=\sup_{x\in\mathbb{R}}\big(xy-f(x)\big)$ and it is shown that $\tilde{\widetilde{f}}=f$... The inequality (**) is called Young’s inequality by several authors. This
is OK, but I cannot see any reason for calling $f\mapsto\widetilde{f}$ the Young transformation.
If you want to include a personal name, it seems Legendre is the closest at hand, even though it does not create the correct association. The “maximum transformation” I have not seen."