I think Jen C. has the right approach. It's OK for him to be mad and it's great that he is attempting to express his anger using words (vs. hitting, yelling, etc.). My 4 y/o daughter also is going through the same thing - telling me she doesn't love me, or that I'm not her mother, or that I'm not nice. I realize this is different than saying "hate" or "stupid." Chances are, your 4 y/o doesn't know what the word "hate" means and is just repeating. I think it's fine to tell him that it's OK to be angry but it is not OK to call names. Name-calling gets a punishment, whether it's a time out or loss of TV time, etc.
The other thing that has been working to diffuse my daughter's anger is when I remind her that I love her when she's angry, I love her when she's sad, I love her when she's happy, etc. I tell her there are things she may do that I may not like and I will tell her (and it's OK to tell when you don't like something), but I will not be mad at her and that I love her anyway. I think that puts her at ease as she is testing her limits right now. Good luck! This is normal and you're not alone!