The infinitesimal length square $dl^2$ of Cartesian and spherical coordinate is
$$ dl^2 = dx^2+dy^2+dz^2 \\ = dr^2 + r^2 d\theta^2 + r^2\sin^2\theta d\phi^2 $$
Therefore, the kinetic energy $T$ is written as
$$ T = \frac{mv^2}{2} =\frac{m}{2}(\dot{x}^2+\dot{y}^2+\dot{z}^2)\\
=\frac{m}{2}(\dot{r}^2 + r^2\dot{\theta}^2+r^2\sin^2\theta\dot{\phi}^2) $$
where $m$ is mass of the particle.
The motion of particle is governed by Lagrangian $\mathcal{L}$
$$ \mathcal{L}=\frac{mv^2}{2}-U(x,y,z) $$
where $U(x,y,z)$ is potential energy.
The momentum $\vec{p}=(p_r,p_\theta,p_\phi)$ of spherical coordinate is written as
$$ p_r = \partial_{\dot{r}} \mathcal{L} = m\dot{r} \\ p_\theta = \partial_{\dot{\theta}}\mathcal{L} = mr^2\dot{\theta}\\ p_\phi = \partial_{\dot{\phi}}\mathcal{L} = mr^2\sin^2\theta\dot{\phi} $$
Angular momentum is $\vec{L}=\vec{r}\times \vec{p}$.
$$ \vec{L} = \vec{r}\times \vec{p} \\
= (yp_z - zp_y)\hat{x}+(zp_x-xp_z)\hat{y} + (xp_y-yp_x)\hat{z}\\
= \underbrace{m(y\dot{z} - z\dot{y})}{L_x}\hat{x}+\underbrace{m(z\dot{x}-x\dot{z})}{L_y}\hat{y} + \underbrace{m(x\dot{y}-y\dot{x})}_{L_z}\hat{z} $$
$$ x = r \sin\theta \cos\phi \\ y = r \sin\theta \sin\phi \\ z = r \cos\theta
$$
$$ L_x = m(y\dot{z}-z\dot{y}) \\ =mr^2(-\sin\phi\dot{\theta}-\sin\theta\cos\theta\cos\phi\dot{\phi})\\
L_y = m(z\dot{x}-x\dot{z}) \\ =mr^2(\cos\phi\dot{\theta}-\sin\theta\cos\theta\sin\phi\dot{\phi})\\
L_z = m(x\dot{y}-y\dot{x})\\ = mr^2\sin^2\theta\dot{\phi}\\
L^2 = L_x^2+L_y^2+L_z^2 = m^2r^4(\dot{\theta}^2+\sin^2\theta\dot{\phi}^2) $$