Children get in a bad mood once in a while. Even so, it is not acceptable to take it out on everyone around. Instead, it is a good opportunity for them to get better at managing their thoughts, feelings, and relationships. An approach that is usually fairly difficult but helpful is to leave your child's bad mood alone at first. You can offer to talk with him about his bad feelings but do not make any effort to cheer him up. He will be happier when he is happier.
Your objective is to deal only with your child's hatefulness. It usually comes off as cutting remarks, putting people down, and being angry. Focus your efforts and energy on helping him better manage these strong feelings.
As you interact with your child, difficult as it will be, resist any urge to react to his hatefulness by being hateful and angry with him. Stay calm and do not take your youngster's hatefulness personally. It probably has little to do with you.
Talk with your child about what is really going on. Say, "Here's the real problem. When you say and do things that are so hateful, it really hurts. Right now, you feel like you are the one who has been hurt. I know that and so do you. Hurting me and other people isn't your best choice, though. I'm going to try very hard not to hurt you even if you feel you need to hurt me. Maybe one of these days, you will not need to take your hurt out on others. Until then, please think about it. Here's an idea. If you can tell me about what's bothering you, maybe we can figure out something to help."
If your child does not talk and persists in being hateful, you might try isolating him. You can have him go to his room or another room of the house until he has thought about his behavior and is able to interact less hatefully. If he returns in the same mood, send him back to his room and then talk with him about his behavior before he is permitted to be with others in the home. If this approach is used, the need to remain calm and non-confrontational is still present. The temptation is to get angry and to try to force your child to behave better. This normally will not work and only tends to make matters worse. You first need to set a good example for him and assertively tell him his behavior is not acceptable to you.
You are teaching your child better ways to handle his angry feelings. Once you have control of your personal reactions and emotions, make a point to begin letting him know when you notice he is doing better. Over time, his moods, attitudes, and behavior likely change in the direction of the behavior you are modeling for him.