[guided]The Hamiltonian depends on $p$ both directly through the dot product $p\cdot v(x,y,p)$ and indirectly through the velocity $v(x,y,p)$. The point of the Legendre transform is that the indirect terms cancel because $p$ is exactly the velocity gradient of $L$.
Define the map
\begin{align*}
V:W\to U
\end{align*}
by
\begin{align*}
V(x,y,p):=(x,y,v(x,y,p)).
\end{align*}
Because $W$ is relatively open by hypothesis, the partial derivatives of $H$ are taken on a genuine relative domain. The assumptions $L\in C^2(U;\mathbb R)$ and $v\in C^1(W;\mathbb R^n)$ imply, by the chain rule for $C^1$ maps, that $H\in C^1(W;\mathbb R)$. Fix $(x,y,p)\in W$ and define
\begin{align*}
\tilde v:=v(x,y,p).
\end{align*}
The inverse Legendre relation says precisely that
\begin{align*}
p=\partial_vL(x,y,\tilde v).
\end{align*}
We first differentiate $H$ with respect to $p_j$, where $j\in\{1,\dots,n\}$. Since
\begin{align*}
H(x,y,p)=p\cdot v(x,y,p)-L(x,y,v(x,y,p)),
\end{align*}
the product rule applied to the dot product gives one direct term $\tilde v_j$ and one indirect term involving $\partial v_i/\partial p_j$. The chain rule applied to $L(x,y,v(x,y,p))$ gives another indirect term involving the same derivatives of $v$. Therefore
\begin{align*}
\frac{\partial H}{\partial p_j}(x,y,p)=\tilde v_j+\sum_{i=1}^n p_i\frac{\partial v_i}{\partial p_j}(x,y,p)-\sum_{i=1}^n \frac{\partial L}{\partial v_i}(x,y,\tilde v)\frac{\partial v_i}{\partial p_j}(x,y,p).
\end{align*}
Now substitute the defining identity $p_i=\frac{\partial L}{\partial v_i}(x,y,\tilde v)$. The two sums are identical with opposite signs, hence
\begin{align*}
\frac{\partial H}{\partial p_j}(x,y,p)=\tilde v_j.
\end{align*}
Since this holds for every component $j$, we obtain the vector identity
\begin{align*}
\partial_pH(x,y,p)=v(x,y,p).
\end{align*}
The derivative with respect to $y$ is similar, except there is no direct derivative of $p$ because $p$ is held fixed when taking the partial derivative $\partial_yH$. For $j\in\{1,\dots,n\}$, the chain rule gives
\begin{align*}
\frac{\partial H}{\partial y_j}(x,y,p)=\sum_{i=1}^n p_i\frac{\partial v_i}{\partial y_j}(x,y,p)-\frac{\partial L}{\partial y_j}(x,y,\tilde v)-\sum_{i=1}^n \frac{\partial L}{\partial v_i}(x,y,\tilde v)\frac{\partial v_i}{\partial y_j}(x,y,p).
\end{align*}
Again the Legendre relation $p_i=\frac{\partial L}{\partial v_i}(x,y,\tilde v)$ cancels the two sums. What remains is
\begin{align*}
\frac{\partial H}{\partial y_j}(x,y,p)=-\frac{\partial L}{\partial y_j}(x,y,\tilde v).
\end{align*}
Since this holds for every component $j$,
\begin{align*}
\partial_yH(x,y,p)=-\partial_yL(x,y,v(x,y,p)).
\end{align*}
These two identities are the only special facts about the Legendre transform needed in the rest of the proof.[/guided]