Suppose $\int_{0}^{2\pi}f(x)e^{-i\lambda x}dx$ is $0$ for $n=0,\pm 1,\pm 2,\cdots$. Define a function
$$
F(\lambda)=\frac{1}{1-e^{-2\pi i\lambda}}\int_{0}^{2\pi}f(x)e^{-i\lambda x}dx.
$$
This function has removable singularities at $\lambda=0,\pm 1,\pm 2,\ldots$ because the integral vanishes for such $\lambda$. So $F$ extends to an entire function of $\lambda$. We show that $F$ must be identically $0$ by first showing that $F$ is uniformly bounded on $\mathbb{C}$, applying Liouville's Theorem to conclude that $F$ is a constant, and then taking a limit to show the constant is $0$.
Let $C_{N}$ be the positively oriented simple closed contour which is the boundary of the square centered at $0$ of width $2N+1$. I'll leave it to you to work out the details of how there is a constant $M$ independent of $N > 0$ such that
$$
\left|\frac{e^{-i\lambda x}}{e^{-2\pi i\lambda}-1}\right| \le M,
\;\;\; 0 \le x \le 2\pi,\;\; \lambda \in C_{N}.
$$
Then, for any $\lambda' \in \mathbb{C}$, there is $N'$ such that $\lambda'$ is inside $C_N$ for $N\ge N'$, and
$$
F(\lambda') = \frac{1}{2\pi}\oint_{C_{N}}\frac{F(\lambda)}{\lambda-\lambda'}d\lambda,\;\;\; N \ge N'.
$$
Using the uniform boundedness of $F$ on all $C_{N}$, you can take a limit of the above as $N\rightarrow \infty$ in order to show that $F$ is uniformly bounded everywhere in the plane. Hence $F$ is a constant by Liouville's theorem. Therefore, there is a constant $C$ such that
$$
\int_{0}^{2\pi}f(x)e^{-i\lambda x}dx = C(1-e^{-2\pi i\lambda}),
\;\;\; \lambda \in \mathbb{C}.
$$
Set $\lambda = -ir$ and let $r\rightarrow\infty$ to determine the constant:
$$
\lim_{r\rightarrow\infty}\int_{0}^{2\pi}f(x)e^{-rx}dx = \lim_{r\rightarrow\infty}C(1-e^{-2\pi rx}) \\
0 = C.
$$
Therefore,
$$
\int_{0}^{2\pi}f(x)e^{-i\lambda x}dx = 0,\;\;\;\lambda\in\mathbb{C}.
$$
That means you can take all orders of derivatives at $\lambda=0$ and also get $0$:
$$
0= \left.\frac{d^{n}}{d\lambda^{n}}\int_{0}^{2\pi}f(x)e^{-i\lambda x}dx\right|_{\lambda = 0} = (-i)^{n}\int_{0}^{2\pi}f(x)x^{n}dx.
$$
So $f$ must be $0$ a.e. because the polynomials are dense in $L^{2}$.