J.S.
Hi, H.! It sounds to me like your daughter can't communicate the very complex things going through her mind, so she gets frustrated! My kids would act out by hitting others, and I've heard of many cases where kids would hurt themselves in frustration. This doesn't make it okay, but there is some things you can do.
I really liked the suggestion of sign language. It's easy to teach (try Signing Time videos, especially the ones about emotions), and at her age she will pick it up rather quickly. Also ask her questions when she does this... "Are you feeling mad? (or whatever you think she may be feeling...)" If she says no, try figuring out by asking questions what it is she's feeling or wanting. Then you can say something along the lines of "I understand that you wanted to play with that toy. It must be very frustrating for you. But we don't hurt ourselves. Instead, say 'I'm mad.' Can you say that?"
This is basically how I worked with my kids to get them to stop hitting. I hope it works for you, too!