That’s a consequence of quantum mechanics, which was responsible for generating the initial ripples from which galaxies and stars later formed.
Quantum mechanics describes reality in terms of probabilities rather than specifics. This makes uncertainty an intrinsic ingredient in the standard model of cosmology - our best explanation of the origin and evolution of the universe.
For that reason, statistics is hugely important in cosmology. The standard model predicts the average properties of all possible universes, not the specific properties of our universe. If we see a discrepancy between our model and the real universe, this may be nothing more than a probabilistic fluke.