Here, broadcasting is copying the (1000,1000) array 1000 times, so it matches the (1000,1000,1000) shape.
H5py will not create the full array in memory first before writing to disk, instead it will write the (1000,1000) array 1000 times, creating the correct array on disk while only using 1/1000 of the memory.
You can read more about the rules of numpy broadcasting here.