Apparently the reason behind it is all to do with the jet stream.
Around the middle of July, the jet stream settles into a pattern which, in the majority of years, holds reasonably steady until the end of August This is the “science” behind the St Swithun’s Day tradition..
When the jet stream lies north of the British Isles then continental high pressure is able to move in, (maybe last summer?) but when it lies across or south of the British Isles, we experience Arctic air and Atlantic weather as has happened this summer with scorching temperatures south of the Jet Stream.
The jet stream is a fast-moving flow of air in the atmosphere which largely dictates the weather in the UK.
If we get stuck with continental high pressure then the weather will be sunny and warm, while Arctic or Atlantic weather systems will bring us wind and rain.
It is fascinating to see how country lore is so often borne out in our modern scientific age!