I had a head banger! It’s very distressing to watch. Mine did it in temper, she had epic tantrums and would beat her head on the hard floor (deliberately moving off carpet) until she was black with bruises. It was awful. The GP said his official diagnosis was “strong personality!” 😂
It can be a few different things. If it’s gentle it may just be a self soothing thing, if it’s more violent like my girl it’s more frustration. My DD is now eleven and we’re on our third attempt at getting her assessed for ASD and ADHD. She is, however, absolutely fine, and does not appear to have given herself lasting brain damage. She still has one hell of a temper though.
If you’re worried talk to your GP. It’s actually quite common, and having some reassurance from a professional can be helpful. We built a padded playpen for ours so that she could head bang without hurting herself.
Even if you’re not worried, it is worth talking to your GP anyway to get your concerns recorded. People ask questions about babies with unexplained bruises. I have twice had a medical professional ask me to undress my daughter to check for other bruises. First one explained why, second didn’t. Don’t take it personally, they’re just doing their job. Sadly there are children who desperately need someone making these checks. These checks weren’t done as a matter of course 40 plus years ago, and I have friends who suffered far longer than they would have as a result. Just cooperate. No one has ever accused me of harming my child. But just be aware that they have to always consider the possibility. It’s not about you.