Let $M, N$ be Riemannian manifolds with metrics $G_M, G_N$, respectively, and assume smooth maps $f: M \to N$ and $g: N \to \mathbb{R}$. Also denote $x \in M$.
The gradient of $f$ can be related to the Euclidean partial derivatives as \begin{equation} \nabla_x f = G_M^{-1} \,\big(\frac{\partial f}{\partial x^1}, ..., \frac{\partial f}{\partial x^m} \big)^T \end{equation}
Knowing that $ d_xf = G_M \, \nabla_x f $ and $d_x(g \circ f) = d_{f(x)} g (d_x f )$, I think that application of the chain rule implies \begin{equation} \tag{1} \nabla_x g = G_M^{-1} \, \sum_i\,\big(\frac{\partial f^i}{\partial x^1}, ..., \frac{\partial f^i}{\partial x^m} \big)^T \, \frac{\partial g}{\partial f^i}. \end{equation} Is this correct, or rather \begin{equation} \tag{2} \nabla_x g = G_M^{-1} \, \sum_{i,j}\,\big(\frac{\partial f^i}{\partial x^1}, ..., \frac{\partial f^i}{\partial x^m} \big)^T \, (G^{-1}_N)_{ij} \, \frac{\partial g}{\partial f^j} \, ? \end{equation}
The gradient is only defined for real-valued functions, so in general your $\nabla_x f$ does not make sense.
On the other hand, because you assume that $g: N \to \mathbb{R}$, the gradient $\mathrm{grad}\, g$ is well defined in the presence of a metric on $N$ as the metric dual to the $1$-form $\mathrm{d} g$ (the differential of $g$).
The chain rule has little to do with the Riemannian structure, it is just the property of the differentials, also known as push-forwards: $$ (f \circ g)_{*} = f_{*} \cdot g_{*} $$
In a choice of coordinates, the differentials are given by Jacobi matrices, so your $g_{*}$ will look like a row vector of partial derivatives, but you need to be more careful with the coordinate patches.
It would be good to know why you need to express the chain rule in such a way in order to provide you more help.