The Prophet ﷺ arrived in Medina, and there was not one of us who did not have one or two nicknames. Whenever he would call someone by his nickname, we would say, "Messenger of Allah, he dislikes this." So the verse was revealed, "And do not insult one another with nicknames" [Hujurat 49:11].
قال حدثنا حفص بن غياث قال حدثنا داود بن أبي هند عن الشعبي
له قدم النبي ﷺ وليس أحد منا إلا له لقب أو لقبان قال فكان إذا دعا بلقبه قلنا يا رسول الله إن هذا يكره هذا قال فنزلت {ولا تنابزوا بالألقاب}
Its isnad is sahih. Its narrators are well known, and Abu Jubayrah is said to have companionship [with the Prophet], as we mentioned before. The hadith was narrated by Abu Dawud, 4/29, no. 4962, in the book of Manners, chapter on Nicknames, and Tirmidhi, 5/388, no. 3268, in the tafsir of Surah Hujurat, where he said, hasan sahih, and Ibn Majah, similarly to Abu Dawud, 2/1231, no. 3741.