I was told at one time that the fact that they act out with Mom means that they are most comfortable with you and can "let go" a bit. They get stressed, too, and need to let off steam. Unfortunately for moms, it is typical that you see THAT side. That does not mean that you let him off the hook, but you can take it as a good sign. And yes, he does know good behavior, so you are doing a good job!
When he is having a hard time, maybe if you can stop for a minute and explain that Mommy needs some time to do some things and that you need him on his "best boy" behavior, and then you will be ready to do what he wants more quickly. (I know he is 3, and this will take a while for it to sink in with him). When he gives you 10 minutes of good behavior, praise him and do something fun for a few minutes. If there is anyway to involve him with helping you, that might help him feel like a big boy, too. My almost 3 year old will help more often than my 10 and 12 yo children :-).
Hopefully, when they get older, they will still be more comfortable with coming to you when they are having a bad day, and "letting go" of their problems.