There is some amount of choice involved here, so you're not stating an invariant physical fact.
First set of definitions. If you define the force of gravity as a scalar (not a vector) $g=\frac{G M}{r^2}$, and if you define $\phi=-\frac{G M}{r}$, then you do indeed have $g=\frac{d\phi}{dr}$ and $\phi=-g r$. This is mathematically true as you have pointed out.
Second set of definitions. If you define $g=\frac{G M}{r^2}$, and if you define $\phi=-\frac{G M}{r}+C$ for some constant $C$, then you still have $g=\frac{d\phi}{dr}$, the physics and forces are totally unchanged, but you no longer have $\phi=-gr$. Physically, you can add any constant to a potential and the result stays unchanged. So your teacher may want to point out that this alternative definition is valid, and in this alternative definition your law does not hold.
Also note that usually, one would prefer to say $g=-\frac{G M}{r^2}$ and $g=-\frac{d \phi}{dr}$, reflecting the fact that the force $mg$ should accelerate objects down the potential. That negative sign is an important when defining potentials!
Third set of definitions. (Added later). As EL_DON points out, another commonly used definition is to take $g$ as a constant, $g=9.81 \frac{m}{s^2}$. With this definition $g\neq -\frac{G M}{r^2}$, except given a specific mass and radius. So, if your teacher is using this set of definitions, clearly $g=-\frac{d \phi}{dr}$ can't be a correct statement.
Fourth set of definitions. And finally, in the most general version of Newton's law of gravity, $\phi(x,y,z)$ is a scalar and the gravitational field $\vec{g}=(g_x,g_y,g_z)$ is a vector. The relations are then $\phi=-\frac{G M}{\|\vec{r}\|}$ and $\vec{g}=-\vec{\nabla} \phi$, where $\|\vec{r}\|$ is the length of the vector $(x,y,z)$ (that is, $\|\vec{r}\|=\sqrt{x^2+y^2+z^2}$), and where $\vec{\nabla} \phi=(\frac{d\phi}{dx},\frac{d\phi}{dy},\frac{d\phi}{dz})$. In this case the equation $\phi=\vec{g}r$ isn't even well formed, because one side is a scalar and the other is a vector! So this is another viewpoint from which your equation isn't correct. (However, it would still hold true that $\phi=\vec{g}\cdot\vec{r}$)
So there's one set of definitions under which your equation is true, and two or three sets of definitions under which your equation is not true. Your teacher was probably thinking about the second or third set of definitions.