We are told to integrate $\pi (r^2-x^2)$ from $-r$ to $r$
$$V=\int_{-r}^{r}\pi(r^2-x^2)dx=2\pi\int_0^r(r^2-x^2)dx=2\pi\left[r^2x-\frac{x^3}{3}\right]_0^r=2\pi\left(r^3-\frac{r^3}{3}\right)=\frac{4}{3}\pi r^3$$
why does the integral of $r^2$ equal $r^2 x$?
Clearly you are trying to find the volume of a sphere. $r$ is radius and so you treat it as a constant, like $2$ for example. So when you integrate a constant, what do you get?