Kinda the same reason as people aren’t distributed uniformly throughout the globe.
People like to live with people. They are attracted to other people. They are attracted to living near friends, family, and loved ones. So they cluster into villages, towns, and cities.
In the case of stars, the “attraction” comes from the force of gravity. But it’s the same basic principle — take something uniform, let attraction happen, and the population will start to cluster. Into star clusters, galaxies, and galaxy clusters