It depends on what is meant by "polynomial".
If only $\sum c_n z^n$, then every function that is uniformly approximable by polynomials must be holomorphic on the interior of $J$.
Although that condition is trivially satisfied if $J$ has empty interior, that doesn't mean that for such $J$ every continuous function is the uniform limit of polynomials. For example the unit circle has empty interior, but a sequence of polynomials converging uniformly on the unit circle converges uniformly on the closed unit disk by the maximum principle, and thus if $f$ is a uniform limit of polynomials on the unit circle, then there is a holomorphic function $h$ on the unit disk that extends continuously to the unit circle, with boundary values $f$. In particular, we have
$$\int_{\lvert z\rvert = 1} f(z)\cdot z^n \,dz = 0\tag{1}$$
for all $n \geqslant 0$. (And, in this case, that condition is sufficient.)
That phenomenon generalises, if $J$ disconnects the plane, that is, if $\mathbb{C}\setminus J$ has at least two connected components, then the bounded components of the complement of $J$ impose restrictive conditions on the continuous functions that are uniform limits of polynomials similar to $(1)$.
Mergelyan's theorem asserts the converse, if $J$ is a compact subset of $\mathbb{C}$ with empty interior such that $\mathbb{C}\setminus J$ is connected, then every continuous function on $J$ can be uniformly approximated by polynomials (in $z$ only).
If "polynomial" means polynomial in $z$ and $\overline{z}$, or equivalently polynomial in $\operatorname{Re} z$ and $\operatorname{Im} z$, then the Weierstraß approximation theorem holds for all compact $J$.
Let the curve be $\gamma:[0,1] \to K$. I am assuming that $\gamma$ is injective and Lipschitz so $K$ satisfies the conditions of the stated theorem
(thanks to @ruens for pointing this out).
Note that $f(\gamma(t)) = f(\gamma(0)) + \int_0^t f'(\gamma(x)) \gamma'(x) dx$.
Choose $\epsilon>0$ and let $g$ be the $\epsilon$-uniform polynomial approximation to $f'$ on $K$ and define $\eta(t) = f(\gamma(0)) + \int_0^t g(\gamma(x)) \gamma'(x) dx $.
Note that
$|f(\gamma(t))-\eta(t)| \le \int_0^t | f'(\gamma(x)) -g(\gamma(x))|\gamma'(x) dx \le \epsilon l(\gamma)$.
Let $g(z) = \sum_{k=0}^n g_k z^k$ and let $\phi(z) = f(\gamma(0))+\sum_{k=0}^n {g_k \over k+1} z^{k+1}$. Observe that $\eta(t) = \phi(\gamma(t))$.
Note that $|\phi(\gamma(t))-f(\gamma(t))| < \epsilon l(\gamma)$ and
$|\phi'(\gamma(t))-f'(\gamma(t))| < \epsilon$.
Best Answer
$K=[a,b] \subseteq \mathbb C$ is a compact set with connected complement.
Since $K$ has empty interior, "holomorphic in the interior of $K$" is true.
"approximated uniformly" is the same as "$| f(x)− p(x)| < \epsilon$ for all $x \in K$".