Why are there vast spaces between the galaxies?
The gravity of each galaxy pulls all the matter that would be in that space towards some galaxy or another. All the existing galaxies are either so far away from other galaxies that they aren’t affected, already revolve around a galaxy, or have a huge mass themselves. But galaxies move. Eventually (about 4 billion years in the future) the Milky Way Galaxy (our galaxy) will collide with the Andromeda Galaxy.