Every chapter of the Quran has a name.
So, were these names given by Muhammad(saww) or was he told before the revelation that this is for chapter so-and-so?
If not, then who named these chapters?
There is two main theory about it:
Some scholars believe that the names of Suras of Quran are
"Towghifi" which means they have been chosen by the Prophet. For example Ayatollah Mohammad Hadi Marefat claims this theory and says:
each Sura of quran has been named by the Prophet because when one ayah descended from Allah, the Prophet said to put it, in which Sura.
named because of being widely used by people with these names. Ayatollah Javadi Amoli believes it and says:
there is no reason that these Suras are named by infallible and also there are Suras which has a great meaning but their names are not so, for example Al-Baghara (cow) and Al-Naml(ant) ,...
The names are given by the people of that time. These are no given by Allah himself. According to arabic traditions, the names does not necessarily represent the main topic of the chapter.
Scholars hold a variety of opinions on this. Some scholars believe that the naming of the chapters was all divine, that is, Allah informed the Prophet as to what the names of the different chapters are. Ayatollah Haadi Ma'rifat espouses this view in his al-tamheed.
Others believe that some chapters of the Quran were named by Allah whilst others came to be named due to other reasons such as popular usage. Ayatollah Javadi is of this opinion. For example, he believes that Surah al-Baqrah was not divinely named because firstly it is not fitting for such an important surah to be named after an animal and secondly there are some narrations which warn against referring to the Surah as al-Baqrah. Some of our scholars have thus referred to it as "The Surah in which the Cow is mentioned"... Ayatollah Javadi believes that Surahs such as Yaa-seen, Fatiha etc were named by Allah whilst others like Ankaboot, Naml, Baqrah came to be named by the people.
I read an interesting discussion which provides references for some of the views on the following page... https://lightofthefurqan.wordpress.com/2016/01/10/ayatollah-javadi-naming-the-chapters-of-the-quran/