We are given two unit vectors \( \overrightarrow{a} \) and \( \overrightarrow{b} \), and the angle between them is \( \frac{\pi}{4} \).
The formula for the dot product of two vectors \( \overrightarrow{u} \) and \( \overrightarrow{v} \) is:
\[ \overrightarrow{u} \cdot \overrightarrow{v} = |\overrightarrow{u}| |\overrightarrow{v}| \cos \theta. \]
Since \( \overrightarrow{a} \) and \( \overrightarrow{b} \) are unit vectors, their magnitudes are both 1, so: \[ \overrightarrow{a} \cdot \overrightarrow{b} = \cos \frac{\pi}{4} = \frac{1}{\sqrt{2}}. \] Now, we need to calculate the expression: \[ (\overrightarrow{a} + (\overrightarrow{a} \cdot \overrightarrow{b}) \overrightarrow{b}) \cdot (\overrightarrow{a} - (\overrightarrow{a} \cdot \overrightarrow{b}) \overrightarrow{b}). \] Substitute \( \overrightarrow{a} \cdot \overrightarrow{b} = \frac{1}{\sqrt{2}} \) into the expression: \[ (\overrightarrow{a} + \frac{1}{\sqrt{2}} \overrightarrow{b}) \cdot (\overrightarrow{a} - \frac{1}{\sqrt{2}} \overrightarrow{b}). \] Use the distributive property of the dot product: \[ \overrightarrow{a} \cdot \overrightarrow{a} - \frac{1}{\sqrt{2}} \overrightarrow{a} \cdot \overrightarrow{b} + \frac{1}{\sqrt{2}} \overrightarrow{b} \cdot \overrightarrow{a} - \frac{1}{2} \overrightarrow{b} \cdot \overrightarrow{b}. \] Since \( \overrightarrow{a} \cdot \overrightarrow{a} = 1 \) and \( \overrightarrow{b} \cdot \overrightarrow{b} = 1 \), and \( \overrightarrow{a} \cdot \overrightarrow{b} = \frac{1}{\sqrt{2}} \), the expression becomes: \[ 1 - \frac{1}{\sqrt{2}} \cdot \frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}} \cdot \frac{1}{\sqrt{2}} - \frac{1}{2}. \] Simplify: \[ 1 - \frac{1}{2} + \frac{1}{2} - \frac{1}{2} = \frac{1}{2}. \]
Thus, the value of the expression is \( \frac{1}{2} \), and the correct answer is option (D).