I won’t solve the problem for you, but I will give you a fairly detailed set of suggestions for approaching it.
Clearly you need to figure out what $g$ is doing in order to solve for $f$. Notice that $g(m,\cdot)$ depends only on $g(m,\cdot)$: values of $g$ for one first coordinate don’t depend on values for a different first coordinate. Thus, you can think of $g$ as a collection of one-place functions: for each $m\in\Bbb N$ let
$$g_m:\Bbb N\to\Bbb N:n\mapsto g(m,n)\;.$$
Then the definition of $g$ can be translated as follows: for each $m\in\Bbb N$ the function $g_m$ is defined recursively be
$$\begin{align*}
g_m(0)&=0\\
g_m(n)&=m+g_m(n-1)\text{ if }n\ge 1\;.
\end{align*}$$
Now solve for each of the functions $g_m$. This is straightforward; if nothing quicker occurs to you, just calculate $g_m(n)$ for $n=0,1,2,3,4$, say, observe an obvious pattern, and prove by induction that it actually holds.
Then you can plug your knowledge of the functions $g_m$ into $f$:
$$\begin{align*}
f(0)&=1\\
f(n)&=g_n\big(f(n-1)\big)\text{ if }n\ge 1\;.
\end{align*}$$
Here again you can simply calculate the first few values, observe a simple pattern, and use induction to prove that your conjecture is correct.