Most children have a change in attitude at this time due to peers at school, and how they see other children act. Along with the fact that his father is still active in his life. Now that he is older it is possible that your ex is allowing him to do things that you wouldn't. If the two of you are still friends "so to speak" I would ask him what he is letting your son do while with him. Does he discipline him when he does wrong or does he just let him away with it? I do think you will see a change in him, kids at school can play a big role in a child's life. Has he had friends over to visit? To you approve of his friends etc. These are all things that you have to look at. When he doesn't do what he is told by you, then something should be taken away from him, something that is a favorite. Even sending him to his room for a time out. If you want to point him in the right direction first speak with his father, if the problem isn't there then if you have time, go to his school, see who he plays with during their breaks' etc. and you may find something there that he is just repeating. You want to catch it now because as they get older, get away with things, it will only get worse. Now that he is in school his time with his father is probably narrowed down some and he is feeling hurt. Talk to him, let him know that you love him unconditionally, but let him know that he is hurting your feelings acting the way he is, when he does. Ask him if he would like you to treat him that way, give him something to think about.
Take care, I hope his father is disciplining him, some fathers' feel that they are losing their children because they are growing up. Pls. talk to him first, and maybe if you feel that he would, tell him to have a talk with him as well.
I wish you all the luck and I am sure things will change for the better.