In the front of the brain there is a section called the premotor cortex; motor as in movement. This is the part of the brain where you make plans to move. (It talks to the primary motor cortex which is the part of the brain that sends out the signals that actually make you move). So if you are holding an ice cream cone and you think about moving your arm to bring the ice cream cone up to your mouth, and then you do it, you can see first the premotor cortex lighting up and then the primary motor cortex lighting up. Neurons in the premotor cortex are firing — nothing surprising there. But here is where it gets interesting. If you watch someone else lift their arm and eat the ice cream cone a subset of the same neurons also fire. Just watching other people take an action causes some of the same neurons to fire as if you were actually moving. This subset of neurons have been dubbed, “mirror neurons”. We share these mirror neurons with other primates as well.

https://www.blog.theteamw.com/2010/01/27/100-things-you-should-know-about-people-23-we-are-hard-wired-for-imitation-and-empathy/