Step 1. (Proof under extra assumptions) Assume that
- $f : [0, 1] \to [0, 1]$ is continuous and non-decreasing;
- $\int_{0}^{1} (f(x) - x) \, \mathrm{d}x = 0$;
- $f(0) = 0$, and $f(1) = 1$.
Then the set $U_+ = \{ x \in [0, 1] : f(x) > x \}$ is open, hence it is written as the union of at most countably many disjoint open intervals $(a_i, b_i)$, $i = 1, 2, \ldots $ Also, the continuity of $f$ forces that $f(b_i) = b_i$. So,
\begin{align*}
I_+ &:= \int_{U_+} |f(x) - x| \, \mathrm{d}x
= \sum_{i} \int_{(a_i, b_i)} (f(x) - x) \, \mathrm{d}x \\
&\leq \sum_{i} \int_{(a_i, b_i)} (b_i - x) \, \mathrm{d}x
= \sum_{i} \frac{(b_i - a_i)^2}{2} \\
&\leq \frac{1}{2}\biggl( \sum_{i} (b_i - a_i) \biggr)^2
= \frac{1}{2} \operatorname{Leb}(U_+)^2.
\end{align*}
A similar argument shows that, for $U_- = \{ x \in [0, 1] : f(x) < x \}$ we have
\begin{align*}
I_- := \int_{U_-} |f(x) - x| \, \mathrm{d}x
\leq \frac{1}{2} \operatorname{Leb}(U_-)^2.
\end{align*}
Moreover, from $\int_{0}^{1} (f(x) - x) \, \mathrm{d}x = 0$ we get $I_+ = I_-$. Therefore, together with the observations$ \int_{0}^{1} |f(x) - x| \, \mathrm{d}x = 2I_+ = 2I_-$ and $\operatorname{Leb}(U_+) + \operatorname{Leb}(U_-) \leq 1$, we conclude that
$$ \int_{0}^{1} |f(x) - x| \, \mathrm{d}x \leq \min\{ \operatorname{Leb}(U_+), \operatorname{Leb}(U_-) \}^2 \leq \frac{1}{4}. $$
These inequalities have a nice interpretation in terms of areas:

Step 2. (General case by approximation) Now suppose $f : [0, 1] \to [0, 1]$ is non-decreasing and satisfies $\int_{0}^{1} (f(x) - x) \, \mathrm{d}x = 0$. Then it is not hard to find a sequence $f_n(x)$ satisfying the conditions in Step 1 and $f_n(x) \to f(x)$ for almost every $x$. So, by the dominated convergence theorem,
$$ \int_{0}^{1} |f(x) - x| \, \mathrm{d}x
= \lim_{n\to\infty} \int_{0}^{1} |f_n(x) - x| \, \mathrm{d}x
\leq \frac{1}{4}. $$