So, $g$ must be symmetric in local coordinates.
In order for $g$ to be locally the Jacobian of a vector field $X = (X_1, X_2, \ldots, X_n)$, we must have that there are functions $f_i(x_1, x_2, \ldots, \hat{x}_i, \ldots x_n)$ for all $i$ with $\displaystyle g_{i,j} = \frac{\partial}{\partial_j}\left(\int g_{i,i}\ dx_i +f_i\right) = \frac{\partial}{\partial_i}\left(\int g_{j,j}\ dx_i +f_j\right)$ for all $i \ne j$. $X$ will then be $\displaystyle \left(\int g_{1,1}\ dx_1 + f_1, \ldots, \int g_{n,n}\ dx_n + f_n\right)$
Then, to answer your question, $X$ must itself be a gradient field; this will happen locally if and only if the 1-form $\omega = X^{\flat}$ (musical isomorphism) has its exterior derivative $\eta = d\omega$ equal to 0 (this functions as a "curl" of the vector field).