It almost sounds to me like it’s just kinda of an auto reflex to some discomfort she’s experiencing…maybe gassy or something? I’m definitely not an expert though, so I’d ask her pediatrician.
You can start trying to redirect, but it likely is some type of reflex (babies tend to slap things away that cause discomfort, pinching/grabbing faces is super common as they are trying to explore and see how far can I pull this, is it something that I can have by itself?) Like if my daughter grabs glasses or hair we grab her hand gently to have her release and say "no, we don't pull/grab ___ it hurts" doesn't do much yet but makes my older daughter (almost 4) and us feel like we are doing something about it lol
My son is the same way and it drives me crazy. It just comes out of nowhere we could be snuggling and I give him kisses on his face and boom he gets wicked pissed off and starts hitting and pushing and kicking me in the stomach
She could possibly be overstimulated. Some babies (especially those who seem advanced) can get overstimulated easier than others. My biggest recommendation is go into a dark room with a sound machine going and help her regulate through skin to skin or just rocking her while holding her so she can adjust by your heartbeat/breathing. This always helped my two year old when she was this age (still does tbh)
Everything is new and exciting and honestly overwhelming. They are sensing new things and seeing farther and lights are brighter and they don’t know how to do what they want and their teeth hurt and being touched could be like the thing that sends their tiny nervous system over the edge. Them acting like that is just a sign they need a change in environment
I dealt with the same thing with my little boy he's now 4 months old my doctor told me to offer him a extra 4 oz every 2 hours; at first I was like I thought that was a lot but over time he became a more happy baby. Sometimes he takes the whole 4 sometimes he only takes 2 or 3. It's crazy I didn't think it was that simple of a fix but it really is give it a try and see if it works for your baby.
Funny, around 2-3 months my LO started hitting me too. Like when she was upset she would make fists and bang on my chest. Honestly that went away, she's almost 5 months now and doesn't do it anymore. I think she was just uncomfortable from gas, and once she regulated that, she went back to being herself. My advice is just to comfort and soothe as best as you can. Not a good idea to react too much. I typically just held her close and sung when she did that.