Another way to describe $g_n$ is:
$$
g_n = \sup\{ g : g \text { is $n$-Lipschitz and }
g \le f\}
\tag{1}$$
The key point is that the property of being Lipschitz with a fixed constant is preserved under taking supremum or infimum. Hence, we can take the supremum of all $n$-Lipschitz minorants of $f$, this obtaining the greatest $n$-Lipschitz minorant (or $n$-Lipschitz lower envelope) of $f$. As $n\to\infty$, it converges to $f$.
To connect (1) to your formula, observe that the requirement $g(x)\le f(x)$ together with $g$ being $n$-Lipschitz force $g(x)\ge f(p)+nd(x,p)$ for all $p$. Thus, $g\le g_n$. On the other hand, $g_n$ belongs to the family; hence it is the supremum.
The Lipschitz modulus of continuity is the simplest one to use, but one could equivalently take the supremum of all minorants that satisfy the Hölder condition of order $\alpha$ with constant $n$. Or use any sequence of moduli of continuity that grows to infinity. The idea stays the same: the set of all functions with a particular modulus of continuity is a lattice.
One can also take infimum of $n$-Lipschitz majorants, arriving at a counterpart of $g_n$:
$$\begin{split}
h_n(x) &= \inf\{ h : h \text { is $n$-Lipschitz and }
h \ge f\} \\ &= \sup\{f(p)-n d(x,p) : x\in X\}\end{split}
\tag{2}$$
You may want to compare (1) to another construction:
$$
\phi = \sup\{ h : h \text { is convex and }
h \le f\}
\tag{3}$$
where "convex" can also be replaced by "affine". The construction (3) makes sense only on linear spaces, since it refers to convexity. But the idea is similar: having a property that is preserved under taking supremum, we can build the greatest minorant with the given property.
It's called the convex envelope of $f$, I believe.