From Wikipedia: a function $f$ is real analytic on an open set $D$ in the real line if for any $x_0 \in D$ one can write
$$f(x) = \sum_{n = 0} ^ \infty a_n (x - x_0) ^ n$$
in which the coefficients $a_0, a_1, ...$ are real numbers and the series is convergent to $f(x)$ for $x$ in a neighborhood of $x_0$.
Here is an example of a smooth function which is not analytic at the origin $x = 0$ from Wikipedia.
$$f(x) = \begin{cases} e ^ {-\frac{1}{x}} & \text{if } x > 0, \\\\ 0 & \text{if } x \leq 0, \end{cases}$$
defined for every real number $x$.
The proof: The function $f$ is smooth, and all its derivatives at the origin are $0$. Therefore, the Taylor series of $f$ at the origin converges everywhere to the zero function,
$$\sum_{n = 0} ^ \infty \frac{f ^ {(n)}(0)}{n!} x ^ n = \sum_{n = 0} ^ \infty \frac{0}{n!} x ^ n = 0, \qquad x \in \mathbb{R},$$
and so the Taylor series does not equal $f(x)$ for $x > 0$. Consequently, $f$ is not analytic at the origin.
On the other hand the Legendre polynomials $(P_n)_n$ form a complete orthogonal system on the Hilbert space $V = L ^ 2([-1,1];\mathbb{R})$ with the scalar product
$$\langle f, g \rangle = \int_{-1} ^ 1 f(x) g(x) \mathrm{d} x$$
and $f(x)$ can be written as
$$f(x) = \sum_{n = 0} ^ \infty c_n P_n(x), \qquad x \in [-1,1],$$
hence the function $f$ can be written as a power series.
But why is it $f$ not analytic then?
The two notions of convergence, pointwise convergence and the $L^2$ convergence differ.
See for instance https://mathoverflow.net/questions/186433/a-e-pointwise-convergence-of-l2-functions-counterexample-for-generalization-o