A lot of times mathematics, it's actually more important that there is a function from some structure $X$ to a structure $Y$ with certain properties than what the function actually does on the values. That's just details. So to capture this essential information, we write
$$f : X \to Y$$
and there's no other notation for it. $f$ could not be equal to $X \to Y$, it's just its type.
If you know programming in a statically typed language like C#, it's like giving the signature of your methods
int Add(int, int);
or even closer in Haskell
add :: Int -> Int -> Int
You can get a great deal of your program right by just working out the datatypes and leave all procedure code blank. What they do is details ;)
So if you write down a function, you give the essential information
$$f : \mathbb R \to \mathbb R$$
and then (maybe) add what it does in detail
$$f : \mathbb R \to \mathbb R, x \mapsto x^2$$
This can even be more concrete
$$f : \{1,2\} \to \{a,b\}, 1 \mapsto b, 2 \mapsto a$$
Now if it's completely obvious what domain and target of your function are, the above may be shortened to
$$f : x \mapsto x^2$$
However you could just say $f(x) = x^2$ as well. The long form here is "Let $f : \mathbb R \to \mathbb R$ be defined by $f(x)=x^2$".
You can be customary to think of $x \mapsto x^2$ as an anonymous function $\mathbb R \to \mathbb R$. In this context, it would make sense to write $f = (x \mapsto x^2)$. There are other notations to it, like lambda-calculus $f = \lambda x.x^2$. However, this is just common in contexts where you deal with functions of functions. For example
$$i(x) := (u \mapsto u(x))$$
though you could write as well
$$i(x)(u) = u(x).$$
Confusing? That's why we usually dont think of $x \mapsto f(x)$ as an anonymous function but just of an explanation what $f : X \to Y$ does.