5. Given real numbers $x, y$ satisfy $x+y=1$. Then, the maximum value of $\left(x^{3}+1\right)\left(y^{3}+1\right)$ is
5.4.
$$
\begin{array}{l}
\text { Given }\left(x^{3}+1\right)\left(y^{3}+1\right) \\
=(x y)^{3}+x^{3}+y^{3}+1 \\
=(x y)^{3}-3 x y+2,
\end{array}
$$

let $t=x y \leqslant\left(\frac{x+y}{2}\right)^{2}=\frac{1}{4}$, then
$$
f(t)=t^{3}-3 t+2 \text {. }
$$

Also, by $f^{\prime}(t)=3 t^{2}-3$, we know that $y=f(t)$ is monotonically decreasing when $t \in (-\infty,-1)$, and monotonically increasing when $t \in \left(-1, \frac{1}{4}\right]$.

Therefore, when $t=-1$, $f(t)$ has a maximum value of 4, i.e., $\left(x^{3}+1\right)\left(y^{3}+1\right)$ has a maximum value of 4.