I'm reading a lecture about Fourier series ,
and it says that you can represent any continuous function as Fourier series.
There's a given example:
Let $f(x) = x$. $f(x) \approx \sum_{n=1}^\infty \frac{2(-1)^{n+1}}{n}\sin(nx).$
So I can understand that $5 = f(5) = \sum_{n=1}^\infty \frac{2(-1)^{n+1}}{n}\sin(5n)$
According to wolframalpha, the sum of this series is $\approx -1.283$
What is wrong here ..?


This Fourier series represents the function in the interval $(-\pi,\pi)$ and converges everywhere to $f$ in that interval.
As you can already see from the formula, the Fourier series is periodic with period $2\pi$, it can therefore impossibly represent $f(x)=x$ on the entire real axis.
Note that already for $x=\pm \pi$ it doesn't represent $f$ anymore since $\sin(\pm n \pi)=0$ for all natural numbers $n$.
As noted in the comment by ccorn, this also explains the value you got. Since $3\pi>5>\pi$ you are in the period $(\pi,3\pi)$, therefore the value of the Fourier series there should be $5-2\pi\approx-1.283$.