Let $p(t) = (x(t), y(t))$ be a parametrization of a smooth curve $(a,b) \to [0,\infty) \times (-\infty,0)$, and assume it satisfies the "zero total energy parametrization" $(x')^2 + (y')^2 = -2y$. We want the apparent force (given by combining acceleration and gravity) at any time to be in a counterclockwise direction from the velocity vector. Using cross products, we find that this is equivalent to
$$x'(t)(y''(t) + 1) \geq x''(t)y'(t).$$
If you set the difference between the sides to a (Edit: sufficiently) positive constant and numerically integrate with good initial conditions, you should get a periodic sequence of narrow loops, like a frictionless roller coaster (note that this does not require the zero energy condition).
Now, we consider the special case where the path satisfies the vertical line test, so $y(t) = f(x(t))$ for some function $f$. By the chain rule, we see that $y'(t) = f'(x(t)) x'(t)$ and $y''(t) = f''(x(t))x'(t)^2 + f'(x(t))x''(t)$. Feeding this into the inequality and simplifying, we obtain the condition
$$f''(x(t))x'(t)^2 + 1 \geq 0.$$
In order to express this purely in terms of $f$, we substitute our variables into the zero energy condition to get $x'(t)^2 + f'(x(t))^2 x'(t)^2 = -2f(x(t))$, which simplifies to $x'(t)^2 = -2\frac{f(x(t))}{1 + f'(x(t))^2}$. The inequality then becomes:
$${f'}^2 + 1 \geq 2f'' f$$
If we apply the substitution $g = f+1$, we get the equation in the question.
You can find similar equations by searching the web with terms like "roller coaster differential equation". For example the second version of equation 4.17 in this document looks like the second displayed equation, but with terms like the mass included.