On October 4, 1582, was the last day of the Julian calendar in Italy, Poland, Portugal and Spain. The next was October 15. Ten dates were removed, and the change was made by the bull Inter gravissimas, issued by Gregory XIII in February 1582 after a commission that had been sitting since the 1560s and had been advised by the astronomer Christoph Clavius and the physician Aloysius Lilius.
The problem was drift. The Julian year is 365.25 days, about 11 minutes longer than the tropical year, and by the 1580s the error had accumulated to roughly ten days. The practical consequence was religious. The council of Nicaea in 325 had fixed the date of Easter by reference to the spring equinox, and the equinox had been falling earlier and earlier in the calendar year, so the date of Easter was drifting away from the rule that set it.
The fix had two parts. Ten days were dropped once, to put the equinox back at March 21. Then the rule for leap years was changed, so that century years would be leap years only if divisible by 400. That left a mean year of 365.2425 days, which is off by about 27 seconds a year and will not need correcting for more than three thousand years.
Adoption took centuries. Catholic Europe went first, and Protestant and Orthodox countries mostly refused what they saw as a papal invention, which caused practical trouble: a letter sent from one country to another could be dated ten days apart. Britain and its colonies switched in September 1752, when eleven days went, and there were riots over it, with people demanding their eleven days back.
Japan changed in 1873, Russia in 1918 after the revolution, and Greece, the last country in Europe, in 1923. The Orthodox churches that did not adopt it still keep Christmas on December 25 by the Julian calendar, which falls on January 7 in the Gregorian one. The calendar is now the world's civil standard, and the rules published in 1582 are the ones still in use.