Partial Differentiation using chain rule
Edit: As pointed out by Ted Shifrin, it's a bit misleading to write $\frac{\partial f}{\partial g}$ when in reality I mean $\frac{\partial f}{\partial z}$ because $f$ is a function of three variables: $x,y,z$. I just so happens that everywhere it's relevant we evaluate $f$ at $(x,y,g(x,y))$.
It becomes clearer when you add back in the arguments. You already have $$\frac{\partial u}{\partial y}=\frac{\partial f}{\partial y}(x,y,g(x,y))+ \frac{\partial f}{\partial z}(x,y,g(x,y))\frac{\partial z}{\partial y}(x,y).$$ So, to find $\frac{\partial^{2} u}{\partial y^{2}}$, we compute the derivatives the same way again. \begin{align} \frac{\partial^{2} u}{\partial y^{2}} &=\frac{\partial}{\partial y}\frac{\partial f}{\partial y}(x,y,g(x,y))+ \frac{\partial}{\partial y}\left(\frac{\partial f}{\partial z}(x,y,g(x,y))\frac{\partial g}{\partial y}(x,y)\right)\\ &=\frac{\partial^{2} f}{\partial y^{2}}(x,y,g(x,y)) + \frac{\partial^{2}f}{\partial z\partial y}(x,y,g(x,y))\frac{\partial g}{\partial y}(x,y)\\ &\quad + \left(\frac{\partial^{2}f}{\partial y\partial z}(x,y,g(x,y)) + \frac{\partial^{2}f}{\partial z^{2}}(x,y,g(x,y))\frac{\partial g}{\partial y}(x,y)\right)\frac{\partial g}{\partial y}(x,y)\\ &\quad+ \frac{\partial f}{\partial z}(x,y,g(x,y))\frac{\partial^{2} g}{\partial y^{2}}(x,y) \end{align}
Suppressing the arguments again, we have $$\frac{\partial^{2} u}{\partial y^{2}} = \frac{\partial^{2} f}{\partial y^{2}} + \frac{\partial^{2}f}{\partial z\partial y}\frac{\partial g}{\partial y} + \left(\frac{\partial^{2}f}{\partial y\partial z} + \frac{\partial^{2}f}{\partial z^{2}}\frac{\partial g}{\partial y}\right)\frac{\partial g}{\partial y}+ \frac{\partial f}{\partial z}\frac{\partial^{2} g}{\partial y^{2}} $$
which if you know that the second order partial derivatives are continuous becomes $$\frac{\partial^{2} u}{\partial y^{2}} = \frac{\partial^{2} f}{\partial y^{2}} + 2\frac{\partial^{2}f}{\partial y\partial z}\frac{\partial g}{\partial y} + \frac{\partial^{2}f}{\partial z^{2}}\left(\frac{\partial g}{\partial y}\right)^{2}+ \frac{\partial f}{\partial z}\frac{\partial^{2} g}{\partial y^{2}}.$$ You can compute the other second order partial derivative in a similar manner. Suppressing the arguments this time from the start: \begin{align} \frac{\partial^2u}{\partial x\partial y} &= \frac{\partial}{\partial x}\frac{\partial f}{\partial y}+ \frac{\partial}{\partial x}\left(\frac{\partial f}{\partial z}\frac{\partial g}{\partial y}\right)\\ &=\frac{\partial^{2}f}{\partial x\partial y} + \frac{\partial^{2}f}{\partial z\partial y}\frac{\partial g}{\partial x} + \left(\frac{\partial^{2}f}{\partial x\partial z} + \frac{\partial^{2}f}{\partial z^{2}}\frac{\partial g}{\partial x}\right)\frac{\partial g}{\partial y} + \frac{\partial f}{\partial z}\frac{\partial^{2}g}{\partial x\partial y}. \end{align}