hi, i have a problem with differentiating please help

(I think) It is well known that for an integral-defined function, differentiating them with the upper limit(i.e. 'x') takes the integral away. (*) i.e.

The problem is, I came across a weird question today:

determine

Well, integrating first and differentiating yields the (probably) correct answer

But when i apply the rule (*) 'differentiation of integral-defined function', it gives a completely different result

Can anybody tell why?