You don't! You have no control over "W". You are told that W is continuous and that is all you can assume about W. If you believe that W must also be differentiable for the conclusion to be true then you believe that the statement you are asked to prove is false!
For example, suppose W(x)= |x| which is continuous for all x but not differentiable at x= 0. Then U(x)= 2+ x^2+ x|x|. If x> 0, that is the same as U(x)= 2+ x^2+ x^2= 2+ 2x^2. That has derivative U'= 4x which goes to 0 as x goes to 0. If x< 0, that is the same as U(x)= 2+ x^2- x^2= 2 which has derivative 0 for all x> 0. Again that goes to 0 as x goes to 0.
That requires knowing that a function, f, is differentiable at x= a if and only if \lim_{x\to a^-}f'(x)= \lim_{x\to a^+}f'(x) which is a result of the fact that, even though a derivative is not necessarily continuous it must still satisfy the "intermediate value property".
More direct would be to calculate the derivative at 0 directly from the definition:
\lim_{h\to 0}\frac{U(h)- U(0)}{h}= \lim_{h\to 0}\frac{(2+ h^2+ h|h|)- 2}{h}
\lim_{h\to 0^+}\frac{h^2+ h|h|}{h}= \lim_{h\to 0^+}\frac{2h^2}{h}= \lim_{h\to 0^+}2h= 0
\lim_{h\to 0^-}\frac{h^2+ h|h|}{h}= \lim_{h\to 0^-}\frac{0}{h}= \lim_{h\to 0^+}0= 0
Since those two limits exist and are equal,
\lim_{h\to 0}\frac{h^2+ h|h|}{h}
itself exists and the function is differentiable.
Do that with U(x)= 2+ x^2+ xW(x) using only the fact that W is continuous.