Why doesn't integrating the area of the square give the volume of the cube?
It should be:
$$V = \int_0^a a^2 dz$$
where $a$ is the length of one of the sides of the square.
Or using your notation:
$$V = \int_0^x x^2 dz$$
where $z$ is the dimension over which you are integrating.
Actually, you have two errors there:
The minor one is that you seem to want a cube of side $2r$, since your integral goes from $-r$ to $r$.
The major error, as others have said, is that you are finding the volume of a pyramid, not a cube. Actually, since you are integrating from $-r$ to $r$, you are finding the volume of two pyramids, one upside-down, touching at their points. That is why you get $2r^3/3$, when the volume of one pyramid is $r^3/3$.
The real problem here is not the endpoints of your integral, it's that the function you are integrating is not constant with respect to the variable of integration. A cube has the same cross section everywhere, while in your original integral the cross section is bigger at the ends than in the middle. See @response's solution for the right way to set this up.