It's like a random walk, basically. Now realize that the photon has something like 700000 kilometers to go and a mean free path in the core in the range of one millimeter or so and it's kind of obvious that this will necessarily take some time.
So this is based on mathematical modeling. Here's one reference I found [1] that estimates 5,000 years. I know I've heard 30,000 too, which is really within the same order of magnitude.
When I was younger (like three decades ago), the number I was taught was something like two million years (if I remember it correctly; I might still be able to find that book if I'm lucky).
To add to the confusion, I vaguely recall a number of around 125,000 years. I think it was either from "A Brief History of Time" or Jeff Forshaw's "Why Does E=mc2?".
I’m guessing you meant photons but this still seems amazing. Is there somewhere I can find out more about that?