I am not sure why you are confused.
To find a maximum or minimum point of a function, set the derivative equal to zero and solve for the variable.
The solution is the value of the independent variable for which the function attains a local minimum or maximum point.
This is not strictly true!
The theorem which you utilize in this situation says that if a function has a local maximum or minimum, then at that point the derivative will be zero. The derivative will also be zero at a point of inflection with a horizontal tangent (e.g. f(x)=x3 at x=0).
Also the function may have a maximum or minimum at the endpoint of an interval and the derivative may not be zero there.
I hope this explanation helps.