Although the D major version is the one usually performed, Bach originally wrote the Magnificat in E flat major. It was written for Christmas, and had interpolations of Christmas pieces, including a gorgeous setting of Vom Himmel Hoch and a really rather difficult Virga Jesse.
E flat had particular connotations – three flats symbolising the Trinity. His St Ann Fugue is also in E flat – he like this key.
However, E flat is a pain for natural trumpets. No doubt the Leipzig trumpeters whinged, so for the Magnificat’s next airing, he dutifully transposed it down a semi-tone.