Why is the potential function defined differently in physics and calculus? I am very familiar with the concept of a potential function, and potential energy, from calculus-based physics.
For instance, if we have the familiar force field $\mathbf{F} = -mg \,\mathbf{j}$, then a potential function is given by $U = mgy + C$. (Since potential energy is relative, we have an infinite number of potential functions.)
Notice that the gradient of the potential function is the negative of the force field: $$\nabla U = \nabla(mgy + C) = mg \,\mathbf{j} = -\mathbf{F}.$$
That was perfectly fine with me. But now in vector calculus, I am reading that the potential function $f$ of a vector function $\mathbf{F}$ is such that $\nabla f = \mathbf{F}$. A negative sign appears to have been lost when migrating from physics to calculus.
It seems confusing to call $f$ a "potential function", since it cannot be interpreted as potential energy in the real world. So why is the calculus nomenclature as it is (i.e., why not call this something else and then say the potential function is the negative of it)?

After reading further on in my calculus textbook, I found that they later defined the potential energy as the negative of the potential function.
So it appears that the reasoning presented in my question was correct, but that some sources simply use a slightly different definition for "potential function" – not because it corresponds to potential energy, but because a convenient name is needed for it.
Wikipedia says that the gradient of the potential is the negative of the vector field, but that "In some cases, mathematicians may use a positive sign in front of the gradient to define the potential."
