There are many reasons why people may behave meanly and disrespectfully towards others.
Low self-esteem
It often happens that people with low self-esteem behave meanly and disrespectfully.
Deep down, they believe they don't deserve kindness and respect, so they don't think anyone else deserves it.

Low self-esteem is often the root of bad behavior.
Mean people often do and say hurtful things to others as a way of taking out their anger for having once made them feel bad.
Emotional overload
Low self-esteem can cause them to attack others under the weight of emotional baggage.
Such people may feel depressed. It is difficult for them to feel happy under the weight of their personal problems.
Emotional immaturity
Mean people don't think that their behavior is mean or disrespectful. They may not understand why others are offended by what they said or did.
They don't know what others expect from them and don't perceive their behavior as offensive.
This behavior is likely related to this person's personal problems.
In such situations, you need to try to forgive the offender, especially if he apologized. However, it is also important to understand that by justifying such people, you are simply betraying yourself.