The Julian calendar assumed a year of 365 days and six hours. The true tropical year is about eleven minutes shorter, so the calendar gained roughly three days every four centuries against the sun. By the sixteenth century the spring equinox was falling around 11 March rather than 21 March, the date the Council of Nicaea had worked from when it fixed the rule for calculating Easter in 325. The problem was liturgical before it was astronomical: the church's greatest feast was drifting out of its intended season, and successive councils had asked for a correction without producing one.
The scheme Gregory XIII adopted came from a proposal by the Calabrian physician and astronomer Aloysius Lilius, refined after his death by a commission in which the Jesuit mathematician Christopher Clavius did the decisive work. The bull Inter gravissimas, issued in February 1582, did two things. It removed ten days once, so that Thursday 4 October 1582 was followed directly by Friday 15 October, restoring the equinox to 21 March. And it changed the leap rule going forward: century years would be leap years only when divisible by four hundred, which drops three leap days every four hundred years and holds the calendar close to the sun indefinitely.
Adoption followed confessional lines rather than scientific ones. Catholic Spain, Portugal, Poland and the Italian states changed in October 1582; Protestant Germany and the Dutch republic held out for over a century, Britain and its colonies until 1752, Russia until 1918, Greece until 1923. Orthodox churches largely kept the Julian reckoning for the liturgical year, which is why Christmas is still celebrated in January in parts of the Christian world.