If f(x)=x^3-20 then how it happens that f'(x)=3x^2

Because that is the rule for polynomial derivatives. Add up the derivatives of each term. The derivative of a constant term (like -20 in your case) is zero. The derivative of a*x^n is n*a*x^(n-1)