How to proof that smooth function vanishing on xy-coordinates cross must be of form $xyg$?

By Hadamard's lemma, $f(x,y) = x\phi(x,y)$ for some smooth $\phi$. Since $f(x,0)=0$ for all $x$, we deduce that $\phi(x,0)=0$ for all $x$ and hence $\phi(x,y)=yh(x,y)$ for some smooth $h$. Thus, $f(x,y)=xyh(x,y)$.