We have given you a lot of answers--let's see a little more work for this one.
suppose next that U is finite-dimensional, of dimension n. can you show that {1,x,...x^{n-1}} must all be in U?
we've already (at least you claim you have) shown that if U has dimension 1, then it must be span{c} for c non-zero, that is: span{1}, so let's suppose dim(U) = 2.
then U = span({p(x),q(x)} for 2 LI polynomials p and q. thus D(U) = {ap'(x)+bq'(x): a,b in P}. without loss of generality assume deg(p) ≤ deg(q).
clearly p(x) = c, for some non-zero c (or else deg(p') = deg(p) - 1, and then D(U) is not contained in U). so deg(q) > 0 (since p and q are assumed LI).
now suppose q'(x) is in U (which it must be, for U to be invariant). so q'(x) = ap(x) + bq(x) = ac + bq(x).
thus q'(x) - ac = bq(x).
comparing leading terms, we see that b = 0, so q'(x) = ac, a constant. hence q(x) is linear, say rx + s, and r is non-zero. since 1 = (1/c)c + 0(rx + s), 1 is in U.
since x = (-s/(rc))(c) + (1/r)(rx + s), we see that {1,x} is contained in U, and since dim(U) = 2, U must be P_{1}.
now, use induction to show that if dim(U) = n, U = P_{n-1}.
now, all that is left is to show that U is not finite-dimensional, it must be all of P[x]. with a little cleverness you can use the same argument (what happens if x^{k} is not in U, for some k in N?).