In general, in the lambda calculus syntax, the "$\lambda$" symbol is followed by a variable or identifier, but could the variable following the "$\lambda$" symbol be a lambda expression itself. For example, let
$$\lambda (\lambda x.x).y$$
be called expression $A$. In expression $A$, the first "$\lambda$" symbol is followed by a variable that is an expression "$\lambda x.x$".
In some manner, expression $A$ is similar to the following:
$$(\lambda z.y)(\lambda x.x)$$
If it is valid to do $\beta$-reduction "$[z:=(\lambda x.x)]$", then we get expression $A$:
\begin{align} (\lambda z.y)(\lambda x.x) \\ (\lambda z.y)[z:=(\lambda x.x)] \\ \lambda (\lambda x.x).y \end{align}
What about the following expression, let's call it expression $B$:
$$\lambda ((\lambda z.z)x).y$$
In expression $B$, the first "$\lambda$" symbol is followed by a variable that is an expression "$((\lambda x.x)x)$", which is an expression that evaluates to a single variable, namely "$x$". So would it be valid to reduce expression $B$ as follows:
\begin{align} \lambda ((\lambda z.z)x).y \\ \lambda ((\lambda z.z)[z:=x]).y \\ \lambda (x).y \\ \lambda x.y \end{align}
In some manner, expression $B$ is similar to the following:
$$(\lambda w.y)((\lambda z.z)x)$$
If it is valid to do $\beta$-reduction "$[w:=((\lambda z.z)x)]$", then we get expression $B$:
\begin{align} (\lambda w.y)((\lambda z.z)x) \\ (\lambda w.y)[w:=((\lambda z.z)x)] \\ \lambda ((\lambda z.z)x).y \end{align}