We are given the following functions:
\[
f(x) = \sqrt{x} - 1
\]
and
\[
g(f(x)) = x + 2\sqrt{x} + 1
\]
We need to find the function \( g(x) \).
Step 1: Express \( f(x) \) and solve for \( x \).
Since:
\[
f(x) = \sqrt{x} - 1
\]
we can rewrite it as:
\[
\sqrt{x} = f(x) + 1
\]
Squaring both sides:
\[
x = (f(x) + 1)^2
\]
Step 2: Substitute into the expression for \( g(f(x)) \).
We are given:
\[
g(f(x)) = x + 2\sqrt{x} + 1
\]
Substitute \( x = (f(x) + 1)^2 \) and \( \sqrt{x} = f(x) + 1 \):
\[
g(f(x)) = (f(x) + 1)^2 + 2(f(x) + 1) + 1
\]
Step 3: Simplify the expression.
Simplifying the expression, we get:
\[
g(f(x)) = (f(x) + 1 + 2)^2 = (x + 2)^2
\]
Thus, the final expression for \( g(x) \) is:
\[
g(x) = (x + 2)^2
\]
Final Answer: The correct option is ( \boxed{(x + 2)^2} \).