This first thing that you need to realize is that when you take an integral, if the area is below the x axis, it will come out negative while when the integral is above the axis, it comes out positive. So it's possible for these areas to cancel each other out or come out with a final answer that is negative.
How can an area be negative???? It's just stating that there is a bigger area underneath the axis than on top.
The next thing you need to realize is that your function is a parabola that is opening downward. So we need to find out when the area is above the axis and use only those limits of integration, ignoring all negative areas below the axis.
So 2+x-x2 =0 will give me the x intercepts. Solving this you get
x=2 or x=-1
So your interval to maximize the value of this integral should be [-1,2].
Hope this helped