Why 40 days?
Before about 1582, most Christian countries used the "Julian" calendar. This had a leap year every four years, which means it slowly goes out of synchronisation with the sum.
In 1582, under Pope Gregory a corrected calendar system was calculated in which the century years would only be a leap year if they were divisible by 400. So 1900 would not be a leap year, while 2000 would.
Due to those slight inaccuracies in the Julian Calendar that slowly accumulated, it meant that there was 17 days difference by the late 1500's. Different countries adopted the calendar at different times.
When the Gregorian calendar was adopted in Western Europe, people "lost" 17 days off their calendar. In most western European countries Christmas remained on 25th December, although was suddenly 17 days closer. Not so with the Orthodox Churches, who did not move the dates of the various Christian festivals when the Gregorian calendar came into operation. So for them Christmas is 17 days later, on the 7th January.