Because the Universe has a finite age, about 13.8 billion years: light from stars and galaxies that are too far away has not had time to reach us yet. The expansion of the Universe also weakens the light of distant galaxies. This resolves what is known as Olbers' paradox.
The question runs deeper than it seems. If the Universe were infinite, eternal, static and filled with stars, every line of sight would eventually end on the surface of a star, and the night sky would be as bright as the Sun's disk. Kepler was already discussing the problem in 1610; it is named after the astronomer Heinrich Olbers, who stated it in the 19th century.
The main answer is the finite age of the Universe. Since the Big Bang, light has only been able to travel a limited distance, so we see only an observable Universe, and the stars within it are far too sparse to cover the whole sky. Stars also shine for only a few million to a few billion years. Cosmic expansion adds a further effect: it stretches the light of distant galaxies toward the red and lowers its energy. Interstellar dust, often suggested as an explanation, does not help: warmed by that light, it would end up radiating as much as it absorbs.
The sky is not perfectly dark anyway. At microwave wavelengths it glows faintly in every direction with the cosmic microwave background, a relic of the young Universe at 2.7 K. And even far from any town, the eye can make out the airglow of the upper atmosphere and the zodiacal light.
In practice
Key terms
More questions: Stars and the Universe
Sources: E. R. Harrison, Darkness at Night: A Riddle of the Universe, Harvard University Press, 1987 ; Planck Collaboration, 2018 results (cosmological parameters)