Get a group of a hundred or so people together in an open space. Tell them to run away from each other, but generally "outward". Many of them will bump into each other. Questions?
If a galaxy's motion towards another galaxy exceeds the rate of space expansion between them, the two galaxies will get closer. The closer they get, the less the effect of the expansion will be and the greater the gravitational attraction between them.