How can I help my son understand?

Fellow moms I need advice. I understand this may be a touchy subject and want to address it properly in a way that he can understand.

My son is 7 and goes to a public school. My son has made friends at school with some kids that are African American and use the n word around him and not so good phrases such as “Black African Monkey”. They have also introduced him to the word “Racist”. I have tried explaining to him that those are not kind words/phrases to use and have explained what a racist is to the best of my ability but he does not understand why his friends are saying saying these things about each other. I am not sure how to properly address this other than explaining it’s never nice to make fun of someone whether it’s about their race, how smart they are, how they dress etc. My son is a good kid and definitely isn’t the bully type but I just want to approach this the right way and in a way that a 7 year old can understand so any advice would greatly be appreciated.