I don't understand what is wrong here. Patting should have made her happy.
Well, first off, petting puts you in a position of submission. While that's not wrong in this situation, it does send mixed signals if the other person considers themselves an equal or a superior. Also, its usually only appropriate if the person is a child, but again, that doesn't apply here.
More importantly, he is petting her roughly, like a dog. Instead of petting, you generally pat someone on the head. Not only may they not like the forceful feeling, but in the case of a girl, it simply messes up her hair.
You're a good girl, Akashi.Wrong!How'd you know that, Ooyodo?Admiral... you have a dog, don't you...ruffleruffleruffleYou dummy!What was wrong with that...?