How can a photon emitted when the universe was just a few lightyears in diameter, travel for billions of years without bumping into something? Admitted: I find it already surprising that a photon can travel for billions of years without bumping into something in a universe that has the size of current observable universe but there I guess the answer is just that the universe is really really empty.
However a friend pointed out that for photons having traveled for 13 billion years and only being observed now the not bumping into something is even more surprising: they started their 13 billion light year journey at a time that there wasn't even 13 billion light years of space available to travel through. So what happened there? Did the expansion of the universe somehow 'outrun' the photon?
I feel that some of the answers to Why is the observable universe so big? and its many duplicates might also apply here, but since the question is more or less the opposite I would appreciate it if someone could explain it in terms related to the current question.
 A: To your first question, you are right :
the answer is just that the universe is really really empty.
To your second one :
Did the expansion of the universe somehow 'outrun' the photon?
the answer is more complicated.

*

*In some sense, the photons are catching up.
Consider a very small volume, 13 billions years ago, and all the photons is that volume. When time goes on these photons will form a sphere expanding around the original point.
The number of particles with nonzero rest mass within this expanding sphere keeps increasing. In that sense, the sphere of photons does enclose a larger and larger "part" of the Universe, expansion notwithstanding.


*When I did my master thesis is Cosmology, (fifty years ago ? yes, that was fifty years ago !) we did not have exactly the concept of "dark energy", but we did have an essentially equivalent concept, that  was called "cosmological constant". However it was expected to be zero. With a vanishing cosmological constant (i.e. no "dark energy", which we now know to be present) any particle with nonzero rest mass would eventually be enclosed in that sphere (which is not the same as saying that, eventually, the sphere would contain the whole Universe, because the finite time needed to reach particles that were, 13 billions years ago, further and further from the initial volume from which the photons of the sphere started, increases indefinitely : finite for any given particle, arbitrarily large for particles further and further away, I hope that this is clear). But that was only the case provided that the curvature of the Universe vanished, which at the time was also the preferred hypothesis.


*But later, opinions changed. First, it became generally admitted that the curvature of the Universe was negative, still with zero "cosmological constant". And now, we know that there is "dark energy", or (almost) equivalently, a nonzero repulsive "cosmological constant". In both cases, particles that were too far away from the starting point will never be reached by the expanding sphere of photons. The expansion of the Universe accelerates too fast and will indeed "outrun" the photons.
