The only solution is $f(x)=x$. First, we note that if we have two functions $f:X\to Y$ and $g:Y\to X$ such that $f\circ g$ and $g\circ f$ are identity maps, then $f$ and $g$ must be bijective functions. Now take $g=f\circ f$.
Further, because $f$ is continuous and bijective, it must be monotonic. Now, you have two cases, $f$ is increasing, or $f$ is decreasing. If $f$ is increasing and $f(x)>x$, then $x=f(f(f(x)))>f(f(x)>f(x)>x$, which is a contradiction. The inequalities are reversed if $f(x)<x$. If $f$ is decreasing, we have that if $x<f(x)$, then $f(x)>f(f(x))$, so $f(f(x))<f(f(f(x))=x$, and hence $x>f(x)$, which is a contradiction, and similarly if $f(x)<x$.
However, a harder and more interesting problem is asking if you can have a point with period 3. This is impossible for polynomials with integer coefficients, but is possible for continuous functions, but when it happens, things are messy. As shown in the paper "Period three implies chaos", if you have a point of period 3, you will have a point of every other possible order.