Is it true that the Prophet (pbuh) said that Imam Mahdi will have the same name as him, Muhammad ibn ʿAbdullah?
I’ve read somewhere that the Prophet (pbuh) said that Imam Mahdi will be from Ahlulbait, he will have the same name as the Prophet (Muhammad) and his father's name will be the same as the Prophet's father's name (Abdullah).
There is no difference in the belief among Muslims that the Mahdi will be a descendant of ‘Ali b. Abi Talib and Fatima al-Zahra. Even the most bitter Shi’a-hating and Yazid-loving tiny segment of extremist Muslims have this belief.
That, right there, is an important point to ponder upon.
But the majority and brotherly Sunni’s have narrations suggesting that the Mahdi will be a descendant of Imam al-Hasan, rather than Imam al-Husayn, and that his father’s name will be ‘Abdullah.
For the Shi’a al-Mahdi is indeed the descendant of Imam al-Hasan, except that it is his father’s name, al-Hasan al-’Askari, himself a descendant of Imam al-Husayn.
The real difference, as mentioned in the question, is the narration that suggests the name of ‘Abdullah as the father. The Shi’a do not accept that, and neither do many Sunni’s.
In fact, there are a number of Sunni scholars who have acknowledged the birth of the Mahdi as the son of Imam al-Hasan al-’Askari.
For instance, see https://www.al-islam.org/al-imam-al-mahdi-just-leader-humanity-ayatullah-ibrahim-amini/chapter-5-who-was-imam-after-hasan-al#sunni-ulama-and-birth-mahdi
