how do little kids know how to hit

on youtube you will see "funny" videos of a little kids (before school age) hitting a parent and people laughing

Do they understand like how a dog knows how to swim genetically or does that mean the parent hits them/parents hit each other?

Like how is it even a concept to an infant?

**Black out tape over all laptop/cell phone cameras so gov cant spy on me fapping crew**