In general, $f : A \to B$ means that the domain of $f$ is $A$ and that for all $a \in A$, $f(a) \in B$. In this case, $f : \mathbb{Q} \to \mathbb{R}$ means that $f(x)$ only needs to be defined for $x$ a rational number, and $f(x)$ is always a real number.
In this case, because $f(x + f(y))$ is defined for all $y$, it must be the case that $x + f(y) \in \mathbb{Q}$ for all $y$. In particular, $0 + f(y) = f(y) \in \mathbb{Q}$ for all $y$. So we're looking for some $f : \mathbb{Q} \to \mathbb{Q}$ satisfying the above.
Let's start by plugging in $x = 0$. We have $f(f(y)) = f(0) + y$. This tells us that $f$ is injective, since if $f(a) = f(b)$, then $f(0) + a = f(f(a)) = f(f(b)) = f(0) + b$ and hence $a = b$.
Now, let's plug in $y = 0$ into $f(f(y)) = f(0) + y$. This gives us $f(f(0)) = f(0)$. Since $f$ is injective, we have $f(0) = 0$.
So we have $f(f(y)) = y$. Then $f$ is a bijection, and $f$ is its own inverse.
Now let's plug in $y = f(z)$. Then we see that $f(x + z) = f(x + f(f(z))) = f(x) + f(z)$.
Now all functions $f : A \to B$ satisfying $f(x + z) = f(x) + f(z)$ for all $x, z$ are linear whenever $A, B$ are $\mathbb{Q}$-vector spaces. So $f$ must be a linear function.
The only linear functions $\mathbb{Q} \to \mathbb{Q}$ are of the form $f(x) = ax$. For such a function, we must have $f(x + f(y)) = f(x) + y$; that is, we must have $a(x + ay) = ax + y$. So we must have $a^2 = 1$.
So the only functions that could possibly work are $f(x) = x$ and $f(x) = -x$. And these functions do work.