There's a kind of difference of opinion on whether the names of the surahs of the qur'an are proven to be given by the prophet () through divine guidance (this is often referred to as tawqeef التوقيف in Arabic language) and means that Allah revealed them to Muhammad () and he instructed his companions (the sahabah) to give them these names or whether they are based on ijtihad (use of own effort and mind in absence of textual sources and revelation) of the sahabah () (the so called companions of the prophet ()) as we know the collection and compilation of the qur'an in one book has been established after the time of the prophet ().
Among the scholars who considered it as tawqeef we find imam ibn Jarir at-Tabari and imam Jalal ad-Dyn as-Suyuti who even considered this as the only correct opinion in his famous book on the sciences of Qur'an al-Itqan fi 'uloom al-Qur'an (الإتقان).
Imam Ibn Jareer at-Tabari (may Allah have mercy on him) said:
The surahs of the Qur’an have names that were given to them by the Messenger of Allah (blessings and peace of Allah be upon him). End quote.
As-Suyooti (may Allah have mercy on him) said:
It is proven that all the names of the surahs are the matter of tawqeef, based on hadiths and reports. Were it not that I fear it would take too long, I would have explained that. End quote. (Source islamqa #131664)
and similarly said the majority of scholars. Their strongest evidence is this hadith on the compilation of the qur'an and order of the surahs in Jami' at-Tirmidhi at the time of 'Othman ibn 'Affan.
However the fact that some surah's have a couple of different names creates a hint of a doubt: Like al-Faithah which has several names (many of them have been quoted in the sunnah) and surah 9 which is called: Bara'ah (based on the word it begins with) and surat at-Tawabah, surah 17 is known as al-Isra'a and surat Bani Israel etc.
Some scholars therefore said it is mostly tawqeef while the majority says it is tawqeef others said both statements have the same meaning.
Actually the sunnah shows that the names of the surahs as we know by now were known at the time of the prophet () which is a proof for these statements, here a few examples:
Do not make your houses as graveyards. Satan runs away from the house in which Surah Baqara is recited. (Sahih Muslim)
Surat Bani-lsrael, Al-Kahf (The Cave), Maryam, Taha, Al-Anbiya' (The prophets) are amongst my first earnings and my old property, and (in fact) they are my old property. (Sahih al-Bukhari)
The Greatest Name of Allah, if He is called by which He will respond, is in three Surah: Al-Baqarah, Al 'Imran and Ta-Ha. (Hasan)Another chain for something similar from Al-Qasim, from Abu Umamah, from the Prophet (saas). (Sunan ibn Majah)
So what we can safely say is that the names (even different names) of the surahs were known by the sahabah () and one can find backup for them being called so by the prophet () himself for a whole lot of them and later generations mostly considered them as given by divine guidance and therefore considered giving them other names as unlawful.