"(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."
فِينَا نَزَلَتْ مَعْشَرَ الأَنْصَارِ {وَلاَ تَنَابَزُوا بِالأَلْقَابِ) قَدِمَ عَلَيْنَا النَّبِيُّ ﷺ وَالرَّجُلُ مِنَّا لَهُ الاِسْمَانِ وَالثَّلاَثَةُ فَكَانَ النَّبِيُّ ﷺ رُبَّمَا دَعَاهُمْ بِبَعْضِ تِلْكَ الأَسْمَاءِ فَيُقَالُ يَا رَسُولَ اللَّهِ إِنَّهُ يَغْضَبُ مِنْ هَذَا فَنَزَلَتْ {وَلاَ تَنَابَزُوا بِالأَلْقَابِ}