That can be a driver

If many cubes, certainly you don't want to animate them all, so use a driver:

Using the selected cube in the image above, add a driver to its "show in viewports" (and when all is good do the same for "show in renders").
The driver uses some other object's location (an empty) and uses the formula on its x location (named e
for empty):
e <= (self.location.x + self.location.y * 5 + self.location.z * 20)
The empty is animated along X axis from 0 to the amount of cube (multiplied by the size of the cubes).
When the empty moves, we want to change the cube visibility from false to true (so hide_viewport from true to false).
If you want to go along X, then Y, then Z, the formula takes the empty X position and test it over the cube location.
e <= (self.location.x + self.location.y * 5 + self.location.z * 20)
is to:
- change over X
- every y * 5 locations because 5 cubes along x when x changes
- and every z * 20 locations because 5 * 4 cubes along z when z changes
Pragmatically:
Set this driver for the first cube, the one at (0, 0, 0),
then select all the cubes and use CtrlL and "animation data".

this will copy the driver to all other cubes and make the animation.
