We can solve this using the method of slicing. The pyramid has a height of $H=1$. The base is a square with side length 2, so its area is $A_{base} = 2 \times 2 = 4$.
Let's consider a horizontal cross-section at a height $z$ from the $xy$-plane. This cross-section is also a square. Let its side length be $s$. We can use similar triangles to relate the side length $s$ to the height $z$.
Consider the triangle formed by the pyramid's vertex $(0,0,1)$, the center of the base $(0,0,0)$, and the midpoint of a base edge, e.g., $(1,0,0)$. The height of this triangle is 1 and its base is 1. The cross-section at height $z$ creates a smaller, similar triangle with height $1-z$ and base $s/2$.
By similar triangles:
$$ \frac{\text{base of small triangle}}{\text{height of small triangle}} = \frac{\text{base of large triangle}}{\text{height of large triangle}} $$
$$ \frac{s/2}{1-z} = \frac{1}{1} \implies s = 2(1-z) $$
The area of the square cross-section at height $z$ is $A(z) = s^2 = [2(1-z)]^2 = 4(1-z)^2$.
The volume of the pyramid is the integral of these cross-sectional areas from $z=0$ to $z=1$:
$$ V = \int_{0}^{1} A(z) \, dz = \int_{0}^{1} 4(1-z)^2 \, dz $$
We can use a u-substitution with $u=1-z$, so $du = -dz$. When $z=0$, $u=1$. When $z=1$, $u=0$.
$$ V = \int_{1}^{0} 4u^2 (-du) = -4 \int_{1}^{0} u^2 \, du = 4 \int_{0}^{1} u^2 \, du $$
$$ V = 4 \left[ \frac{u^3}{3} \right]_{0}^{1} = 4 \left( \frac{1^3}{3} - \frac{0^3}{3} \right) = \frac{4}{3} $$
The volume is $\frac{4}{3}$ cubic units.