For a proof of the much stronger result indicated above, see Page 53 here; the theorem states the following:
Let $f(x)$ be $C^\infty$ on $(c,d)$ such that for every point $x$ in the interval there exists an integer $N_x$ for which $f^{(N_x)}(x)=0$; then $f(x)$ is a polynomial.
I believe the answer is "no". The key lemma is:
Lemma. Let $f: [c,d] \to {\bf R}$ be smooth, let $I$ be a compact subinterval of $(c,d)$, $q$ be an interior point of $I$, let $n \geq 1$, and let $\varepsilon > 0$. Then there exists a smooth perturbation $g: [c,d] \to {\bf R}$ of $f$ which agrees with $f$ outside of $I$, is a polynomial on a neighbourhood of $q$ of degree at least $n$, but is not a polynomial on all of $I$, and differs from $f$ by at most $\varepsilon$ in $C^n[c,d]$ norm.
If we apply this lemma iteratively for $n=1,2,\ldots$ with $\varepsilon = \varepsilon_n := 2^{-n}$ and $n=0,1,2,\ldots$, starting with $f_0 = 0$, and setting $q = q_n$ to be the first rational (in some enumeration of the rationals) on which $f_n$ is not locally polynomial,
one obtains a sequence $f_1, f_2, f_3,\ldots$ of smooth functions on $[c,d]$ which form a Cauchy sequence in $C^k$ for each $k$, and thus converge in the smooth topology to a limit $f$ which is equal to a polynomial on degree at least $n$ on an interval $I_n$, with the $I_n$ disjoint and covering all the rationals, thus dense in $[c,d]$, giving the claim.
To prove the lemma, recall from the Weierstrass approximation theorem that the polynomials are dense in $C^0[c,d]$; integrating this fact repeatedly we see that they are dense in $C^n[c,d]$ as well. So we can approximate $f$ to arbitrary accuracy by a polynomial $h$ in the $C^n$ norm; by a small perturbation one can ensure that $h$ has degree at least $n$. Now using a smooth partition of unity, one can create a merged function $g$ that equals $h$ near $q$ and equals $f$, which can be made arbitrarily close in $C^n$. By modifying $g$ a little bit in $I$ away from $q$ one can ensure that $q$ is not polynomial on all of $I$.
The problem here is superficially similar to that in the previous question If $f$ is infinitely differentiable then $f$ coincides with a polynomial , but the latter has qualitative control at every single point (allowing the powerful Baire category theorem to come into play), whereas here one only has qualitative control on a dense set, which is a far weaker statement, and one which allows for a great deal of flexibility.
Best Answer
The proof is by contradiction. Assume $f$ is not a polynomial.
Consider the following closed sets: $$ S_n = \{x: f^{(n)}(x) = 0\} $$ and $$ X = \{x: \forall (a,b)\ni x: f\restriction_{(a,b)}\text{ is not a polynomial} \}. $$
It is clear that $X$ is a non-empty closed set without isolated points. Applying Baire category theorem to the covering $\{X\cap S_n\}$ of $X$ we get that there exists an interval $(a,b)$ such that $(a,b)\cap X$ is non-empty and $$ (a,b)\cap X\subset S_n $$ for some $n$. Since every $x\in (a,b)\cap X$ is an accumulation point we also have that $x\in S_m$ for all $m\ge n$ and $x\in (a,b)\cap X$.
Now consider any maximal interval $(c,e)\subset ((a,b)-X)$. Recall that $f$ is a polynomial of some degree $d$ on $(c,e)$. Therefore $f^{(d)}=\mathrm{const}\neq 0$ on $[c,e]$. Hence $d< n$. (Since either $c$ or $e$ is in $X$.)
So we get that $f^{(n)}=0$ on $(a,b)$ which is in contradiction with $(a,b)\cap X$ being non-empty.