A real analytic function, by definition, admits a power series representation in the neighbourhood of each point in it's domain of definition, that is, it can be written as a power series. This is a very severe constraint, analytic functions, as an example, are constant everywhere (on the affected component of the domain) if they are constant on an open set. The latter is not true for functions which are 'merely' infinitely often differentiable (smooth), you can have smooth functions with compact support (which are very important tools in analysis) -- the example you wrote down is often used to construct such functions.
Figuring out whether a given smooth function is real analytic is usually much more difficult to detect than, e.g., in the case of complex analytic functions, which are just those functions which are complex differentiable. One of the few tools available to show a function is real analytic is the theorem which tells you when the Taylor series of $f$ actually converges to $f$.
(Clearly each complex analytic function gives rise to real analytic ones, so many examples are known. Similarly, harmonic function, i.e. solutions to $\Delta u = 0$ are real analytic, even in higher dimensions.)