Since $f\circ f=id$, we know that $f$ is a bijection.
Now assume that $f\ne id$, i.e., there exists a point $x_0$ such that $$f(x_0)=y_0\ne x_0.$$
We know that also $$f(y_0)=x_0.$$
W.l.o.g. we can assume that $x_0<y_0$.
From the intermediate value property we can get some information about values of $f$.
- We know that all values from the interval $[x_0,y_0]$ must be attained in the interval $[x_0,y_0]$, and every such value is attained exactly once.
- If $x<x_0$, then $f(x)>y_0$. (Otherwise $f$ would attain all values between $f(x)$ and $y_0$ somewhere in the interval $(x,x_0)$, which would mean that some values from the interval $[x_0,y_0]$ are attained twice. This contradicts the assumption that $f$ is a bijection.)
- The same argument shows that $f(x)<x_0$ for $x>y_0$.
(If the above arguments are unclear, it helps to draw a picture.)
So now we know that the only possible fixed points are in the interval $[x_0,y_0]$. Let us assume that there are two fixed points $x_1<x_2$, i.e. we have
$$f(x_1)=x_1<x_2=f(x_2)$$
for some $x_{1,2}\in(x_0,y_0)$.
Since $f(x_1)=x_1<x_2<y_0=f(x_0)$, we get from the intermediate value property that there is $t\in(x_0,x_1)$ such that $f(t)=x_2$. (I.e., the value $x_2$ is attained somewhere between $x_0$ and $x_1$.) But this implies
$$f(x_2)=x_2=f(t),$$
which again contradicts the assumption that $f$ is a bijection.
The following question is similar, but it requires that $f$ is continuous (which is stronger condition than intermediate value property a.k.a. Darboux property): Continuous involutions on $\mathbb R$ with at least two fixed points. I think the argument from one of the answers can be also used here.