The Moon's cycle lasts about 29 and a half days, and its four visible phases each last roughly seven days. Babylonian astronomers, who watched the sky with unmatched patience, divided their months by those phases and treated the seventh days specially. Seven also matched the count of wandering lights visible to the naked eye: the Sun, the Moon, Mars, Mercury, Jupiter, Venus and Saturn. A number that fits both the Moon's quarters and the sky's movers was bound to feel significant, and the seven day rhythm spread from Babylon through the wider region. The day names carry the system across languages: Thursday is Thor's day in English and Donar's in German, but the slot it fills, the fifth day counting from Sunday in the old planetary scheme, is Jupiter's in the Latin tradition, still visible in the French jeudi and Spanish jueves.
Hellenistic astrologers assigned each hour to a planet in a fixed order, and the planet ruling the first hour gave the day its name. Work that order through and you get the sequence still visible in English: Sun day, Moon day, then days named for Tiw, Woden, Thor and Frigg in the Germanic translation, and Saturn keeping his Roman name on Saturday. Romance languages preserve the Roman originals more clearly, with Mars, Mercury, Jupiter and Venus still plain to hear in the weekday names of French, Spanish and Italian. The week also quietly shapes the calendar's mathematics. Because seven does not divide the year, the weekday of any fixed date drifts annually, and perpetual calendars, weekday calculators and the ISO week system all exist to manage that single awkward remainder.
Unlike months and years, the week answers to no astronomy, so reformers have repeatedly tried to change it. Revolutionary France imposed a ten day week in 1793 and abandoned it within a dozen years; the Soviet Union experimented with five and six day weeks and gave up by 1940. Markets, worship and habit all run on seven. The week survives because it is a pure social agreement, and it is now so universal that date systems count weeks continuously without ever resetting, which is why weekday calculators can run centuries in either direction. Perhaps the strangest fact is what the week is not based on. The month approximates the Moon and the year the Sun, but the week approximates nothing in the sky at all. It is a rhythm humans chose and then refused, for three thousand years and counting, to give up.