He's not listening to your aids, head shaking is an evasion. Sink into your stirrups, put your leg on THEN take with the reins.
Mine used to do that when I would go to pull him up. He would throw his head up and run through my hands. Just keep a decent amount of pressure on the reins and eventually he will give in and slow down. With consistency he should take less time to react each time. If he tries to grab the but just giggle the reins so he can't. When doing this don't keep pulling back harder and don't pull back hard at all just make it enough pressure to make it slightly uncomfortable in his mouth. Just remember each horse has a different slowdown time when coming out of a gallop. My horse being an OTTB has a longer slow down than my bosses qh. Eventually this shouldn't exist anymore. It will take time though
Maybe rather than pulling, check and release. This won't let him grab the bit and pull and shake. Maybe try running martingale if it's really bad?
Horses see galloping as fun as they usually get a bit of a rush from it so I'd say he just wants to keep going next time he shakes his head you need to bring him down from gallop straight away to show him that he can't influence how long he gallops
Mine shakes his head to argue with me. What I've been having to do is just argue back with him, telling him what I want him to do is what he's gonna do.
Mine does that too... I think it is I'd like a "Yay! I get to be a horse and I never want to stop!" Thing I just have to circle her in a big circle then make it smaller and smaller:)