A seven-day week first became ‘official’ by decree of the Roman Emperor Constantine in 321 BCE, but it had already been in use since ancient times, by the Sumerians and Babylonias.
One theory is that the week was based on the seven visible celestial bodies from Earth: the Moon, the Sun, Mercury, Mars, Venus, Jupiter, and Saturn. It may also have to do with the length of time it takes for the Moon to pass through its phases.