Gravitational attraction between nearby objects is powerful enough to overcome the initial outward momentum imparted to everything from the Big Bang. If it wasn't,
nothing would have ever touched again after it (i.e. the universe would be solely composed of the tiniest of particles slowly drifting apart).
As for things colliding head-on, here's an illustration. Since the effects of gravity increase as the distance between two bodies decreases, the two galaxies are going to be coming closer and closer to a perfect head-on collision.
Even if they don't have a perfect head-on collision, it's going to make a big mess, and stuff will be flung out from the collision in all directions, only to regroup later with other stuff, now traveling in entirely new directions and attracted to other nearby clumps of things. After many such collisions, you've got a fairly chaotic situation. In such an environment, I'd wager perfect head-on collisions are entirely possible, if not inevitable.
Other reasons this stuff is hard to think about
:
- gravity affects the rate of the universe's expansion (it expands slower in high-gravity areas)
- this isn't just objects moving farther apart along "outward" trajectories - space itself is expanding in all directions
- all we can see is a freeze-frame of any of it, even though the farther we look, the farther back in time we see