Step 1: Identify the slope of the given line.
The given line equation is:
\[
x + y + 1 = 0
\]
Rewriting it in slope-intercept form:
\[
y = -x - 1
\]
Thus, its slope is \( m = -1 \).
Step 2: Find the slope of the required line.
Since the given line is perpendicular to \( x + y + 1 = 0 \), the slope of the required line is the negative reciprocal of \( -1 \), which is:
\[
m' = 1
\]
Thus, the equation of the required line is of the form:
\[
x \cos\alpha + y \sin\alpha - p = 0
\]
Since the slope is 1, comparing with the general form:
\[
-\frac{\cos\alpha}{\sin\alpha} = 1
\]
\[
\cos\alpha = -\sin\alpha
\]
Step 3: Use perpendicular distance formula.
The given perpendicular distance from \( (\sqrt{2}, \sqrt{2}) \) to the line is 5. The distance formula for a line \( Ax + By + C = 0 \) from a point \( (x_1, y_1) \) is:
\[
d = \frac{|Ax_1 + By_1 + C|}{\sqrt{A^2 + B^2}}
\]
Substituting \( A = \cos\alpha \), \( B = \sin\alpha \), and \( C = -p \):
\[
5 = \frac{|(\cos\alpha)(\sqrt{2}) + (\sin\alpha)(\sqrt{2}) - p|}{\sqrt{\cos^2\alpha + \sin^2\alpha}}
\]
Since \( \cos^2\alpha + \sin^2\alpha = 1 \), simplifying:
\[
5 = \left| \sqrt{2} (\cos\alpha + \sin\alpha) - p \right|
\]
From \( \cos\alpha = -\sin\alpha \), we substitute:
\[
\cos\alpha + \sin\alpha = 0
\]
\[
5 = \left| -p \right|
\]
Since \( p \) is positive:
\[
p = 5
\]
Thus, the correct answer is:
\[
\boxed{5}
\]