Sunan Ibn Majah, Book 33, Hadith 86 (In-Book)

It was narrated that Abu Jabirah bin Dahhak said: "(Allah's saying) "Nor insult one another by nicknames(Surah Al Hujarat 49:11)" was revealed concerning us, the Ansar. When the Prophet came to us, a man among us would have two or three names, and the Prophet might call him by one of those names, only to be told: "O Messenger of Allah, he does not like that name." Then:"Nor insult one another by nicknames." was revealed."

حَدَّثَنَا أَبُو بَكْرٍ، حَدَّثَنَا عَبْدُ اللَّهِ بْنُ إِدْرِيسَ، عَنْ دَاوُدَ، عَنِ الشَّعْبِيِّ، عَنْ أَبِي جَبِيرَةَ بْنِ الضَّحَّاكِ، قَالَ فِينَا نَزَلَتْ مَعْشَرَ الأَنْصَارِ ‏{وَلاَ تَنَابَزُوا بِالأَلْقَابِ‏)‏ قَدِمَ عَلَيْنَا النَّبِيُّ ـ صلى الله عليه وسلم ـ وَالرَّجُلُ مِنَّا لَهُ الاِسْمَانِ وَالثَّلاَثَةُ فَكَانَ النَّبِيُّ ـ صلى الله عليه وسلم ـ رُبَّمَا دَعَاهُمْ بِبَعْضِ تِلْكَ الأَسْمَاءِ فَيُقَالُ يَا رَسُولَ اللَّهِ إِنَّهُ يَغْضَبُ مِنْ هَذَا ‏.‏ فَنَزَلَتْ ‏{وَلاَ تَنَابَزُوا بِالأَلْقَابِ}‏ ‏.‏

sunnah.com