Charged enclosed by the sphere

I think you forgot to account for $\mathbf{\hat{z}}$

Let $\mathbf{\hat{r}}$ be the normal to the surface of our sphere. If you take the route of integrating the electric field over the surface of the sphere that contains the charge, then you will be evaluating the following quantity.

$z^2 \mathbf{\hat{z}}.\mathbf{\hat{r}}=z^2 \mathbf{\hat{z}}.\mathbf{r}/r=z^2\, z/r=z^3/r$

So you will be integrating $z^3$ over the surface of the sphere centered on the origin. Since $z^3$ is an odd function the integral will vanish.


There is also a nice geometrical argument for this. Since the field is $\vec E=z^2\hat z$, the fields lines always point along $+\hat z$ and the magnitude of the field does not depend on the position in the $xy$-plane. As a result, every field line that enters the sphere must also exit the sphere, so the net flux must be $0$, and therefore the net enclosed charge must be $0$.

enter image description here