I am a newbie, but my young roo of 17 wks, handled a lot, has in the last couple of weeks made aggressive moves toward me, pecking at my pant legs and shoes. In addition to increasing maturity, the flock has been moved to a new coop/run/tractor during this time. Open to interpretation, but I just realized that as baby chicks kept in brooder / cage well off the ground, they mostly saw the upper part of me, and never really saw me walking around them before. My floppy pant legs and shoes were a new experience for them, and his "attack" was possibly more exploratory than vicious.
I imagine that roosters perceive whatever enters their turf as a possible threat to be checked out: "is it dangerous -- or edible -- or intimidatable"? Perhaps your roo didn't know what to make of the child and did some pecking "research" to figure it out. From his perspective, better and wiser to safeguard his flock by being aggressive up front. That's his job. There is a good Mother Earth article that has been referenced a lot about how you can choose to not be confrontational -- how to not let your roo put you into an adversarial role -- as one approach to peacemaking. A child would, of course, not be safely put in this kind of situation.
At this point, my roo is still pleasant to pick up and hold, but the hormones they are a changing... so I may find that theory and reality are far apart. Good luck with yours, and I'd suggest doing some more research if you are motivated. I do think they need training and that people need roo handling skills and specific strategies planned out for how to react, just like handling a stallion or a bull.