It may be true that the Islamic teaching (fasting Mondays and Thursdays) and the 5:2 diet both have similar patterns or number of days to fast, but there is no connection.
Fasting Mondays and Thursdays for Muslims is based on the hadiths by the Prophet ﷺ saying that he fasted Mondays because it was the day he was born on, and he fasted Mondays and Thursdays because these are the days our deeds are presented, and he sought to have his deeds presented while being on fast. There was no mention anywhere by the Prophet ﷺ that fasting Mondays and Thursdays was due to dietary benefits in general, or the 5:2 diet in specific.
حَدَّثَنَا ابْنُ أَبِي عُمَرَ، حَدَّثَنَا سُفْيَانُ، عَنْ مُسْلِمِ بْنِ أَبِي مَرْيَمَ، عَنْ أَبِي صَالِحٍ، سَمِعَ أَبَا هُرَيْرَةَ، رَفَعَهُ مَرَّةً قَالَ
تُعْرَضُ الأَعْمَالُ فِي كُلِّ يَوْمِ خَمِيسٍ وَاثْنَيْنِ فَيَغْفِرُ اللَّهُ عَزَّ وَجَلَّ فِي ذَلِكَ الْيَوْمِ لِكُلِّ امْرِئٍ لاَ يُشْرِكُ بِاللَّهِ شَيْئًا إِلاَّ امْرَأً كَانَتْ بَيْنَهُ وَبَيْنَ أَخِيهِ شَحْنَاءُ فَيُقَالُ ارْكُوا هَذَيْنِ حَتَّى يَصْطَلِحَا ارْكُوا هَذَيْنِ حَتَّى يَصْطَلِحَا
Narrated through Abu Huraira that the the Prophet ﷺ said:
The deeds are presented on every Thursday and Monday and Allah, the Exalted and Glorious. grants pardon to every person who does not associate anything with Allah except the person in whose (heart) there is rancour against his brother. It would be said: Put both of them off until they are reconciled.
— Sahih Muslim 45/44
There are other hadiths to the same effect in Riyad Al-Saliheen 9/1256 and Sunan Abi Dawud 14/124.