The wooden framed spire was added to the stone tower in the early 1360s. It was initially believed that the twisting was a result of all the skilled craftsmen having died off in the Black Plague, leaving only unskilled laborers to construct the church spire.
The theory now is that the distortion was caused by the lead covering added to the wood shingles some years after initial construction. During the day, the south side of the tower heats up in the sun, causing the lead there to expand faster than that on the north side. This imposes a twisting movement due to the pattern in which the 33 tonnes of lead were applied. Also, in the 14th century, it was common to use unseasoned timber during construction as seasoned wood was too hard to work with the hand tools available at the time. This would cause the wood to warp with the shingles, further facilitating the twist.
As usual, folklore provides much more interesting reasoning for the strange phenomenon. Several local legends hold the Devil responsible. In one tale, a blacksmith was fitting a horseshoe to the Devil’s hoof and knocked a nail into the soft part of his foot. The Devil then jumped over the town in pain, knocking the spire out of shape as he passed. Another story has the Devil sitting on the spire and wrapping his tail around it. The people of the town rang the church bells and the Devil, frightened by the noise, tried to escape with his tail still wound around the spire, causing it to twist.
Another, somewhat cheeky story is that that a virgin from Chesterfield once married in the church and the building was so surprised that the spire turned around to look at the bride. The legend is that that if another virgin from Chesterfield marries in the church, the spire will straighten up again.
According to atlasobscura.com