We assume it's either jealousy or craving attention, but the girl gets a lot of attention and doesn't have any rational reason to be jealous of him.
She has every reason to be jealous of him. You're delighted with him. She's not the center of your universe anymore; she has to share the spotlight. It's quite normal/natural (and rational to her mind.)
TL:DR: Do everything you can correctly and consistently before the option of last resort.
By consistently, I mean, Every. Single. Time. Whether it's convenient or not, whether you're in the grocery store, a restaurant, at friends' houses or dog tired. Pick a stance/tactic and stick to it (i.e. don't jump around between acting angry, time outs, discussion, etc.
Emotional Vocabulary
Talking to her isn't the same as exploring what she thinks, feels, and knows. It's likely (especially because the baby is probably delighting you especially around now with first words, good social interactions, laughing, crawling/cruising and other delightful accomplishments) that she's doing this out of jealousy. She may not recognize "jealousy", and it might mean you have to give her examples, like saying, "let's go have some ice cream!" Then give yourself a big serving and her a teeny tiny one. Ask her how she 'feels'. She will probably say 'mad' or 'sad'. You can then talk about what jealousy is any how it hurts inside, trying to explore ways to help her comprehend. Then give her plenty of your ice cream. Ask her what she feels now - don't settle for 'better'. Help her to name her emotions; give her an emotional vocabulary.
Emotions are not right or wrong; they are a feeling
Make sure your daughter knows that feelings aren't right or wrong, feelings don't make her good or bad; feelings just happen. It's how someone acts when they have feelings that matters. Talk to her about your feelings (noble and ignoble, including jealousy) and how you deal/dealt with them. That way, she might be able to freely express her true feelings to you without feeling shame or fear.
Examples help
Short books, stories, fables, fairy tales, examples of any kind that might interest her wherein the protagonist (or antagonist) feels jealous can help her name and recognize that emotion. Critique not the feeling but how they work through it.
Empathy building
At 3 years of age, kids can feel empathy (it's even been shown in infants) and can be deceitful/know they're doing wrong and do it anyway. You need to give her a reason not to hit her brother that's stronger than her desire to lash out. Help her to imagine how it feels to be struck for no reason; help her to identify with her brother. There is a lot on the internet about building empathy even in preschoolers. This answer is too long already to repeat it. Again, though, books, stories, fairy tails, etc.
Actions have consequences
Praise and reward good behavior. Good choices have good consequences! A sticker chart here would be a great idea.
Children learn about what behaviors are acceptable and not acceptable based on the consequences of them. If you want a child to do a behavior more often, a reward will help.
For your child, the desired behavior is making a choice not to hit her brother.
At 3, the rewards need to be relatively immediate, e.g. an extra game after dinner, an extra book at bedtime, or a cartoon. Rewards can help in learning self control. See The Dos and Don'ts of the Sticker Chart.
On the other hand, if explaining why it's wrong and hurtful does nothing (i.e. until she learns empathy with your help), when it happens, I highly recommend time outs with her, using 1,2,3 Magic (for 2-12yo).* It is for many really magical. There's no pleading, explaining, etc. The first step is to sit her down and explain that there are going to be new rules now and why they are rules, not requests. Generally, kids are warned when they start behaving in any way reasonably unacceptable to you, and if they don't stop, you start counting. You'll find, though, that hitting is an automatic "3" and they go right into a time out. If you want to have a discussion with your child about how loved she is, how harmful jealousy is to her relationships with others, and how bad for her brother hitting is, that is done at the rule setting stage and only after time outs.
If, (if!) properly administered time-outs don't work after a few months, consider spanking. This is very unpopular advice, but hitting a baby is dramatically just not ok. People may argue that spanking teaches kids that hitting is a way to solve problems. It's not a good way to solve problems, but striking an innocent baby is worse, and judicious spanking has never been shown conclusively to do long term harm to a child. Just save it for that one thing: intentionally hurting others even though repeatedly warned not to do so. Thoughtful use of spanking should be replaced by self control and discussion/other consequences by the age of 6 or so.
Another argument might be, why don't you keep the baby and the 3 yo separate? I'm against that because it creates an artificial solution, not one that teaches the child to control herself. It also makes it difficult to have family time, and isn't that kind of punishing the baby as well? The child must learn that hitting her brother is simply not an option whatever she is feeling.
You may need to spank her more than once (I hope not more than twice.) Before you decide on this (which should be your last option), sit down with your child and explain how everything you've tried to help prevent this behavior (and you should have tried everything) has not helped her to control herself, so the new rule is that when she strikes her baby brother, she will get a spanking. Ask her if she knows what that is, and if she doesn't, explain it to her. Make sure she understands. Then, the very next time she does it (no, "What did we talk about?" or other half-measures), don't say a word and just calmly but immediately pick her up, take her to her room or somewhere private, and swat her bottom. The point of this is that it should be immediate and dramatic, not angry, painful, or impulsively done.
(Spanking is defined as) striking the child on the buttocks or extremities with an open hand without inflicting physical injury with the intention to modify behavior. Spanking is intended to be aversive, but not necessarily by inflicting physical pain.1
It will probably scare her or startle her, but don't coddle her. Tell her that you talked about this and this is the new consequence for hitting her brother. It's not that you love her brother more than her, it's just that her brother is completely innocent and she is not.
Good luck. This is a difficult situation to deal with, but it is surmountable with patience, persistence, kindness, and wisdom.
*Most people think they know how to do this correctly but they don't. This is a very specific method that, if done improperly, will do absolutely nothing but confuse or frustrate the child. Please, buy the book and read it cover to cover before trying to implement it. It's not a long book, and there are videos on Youtube to help as well.
When I had baby #2, #1 expressed jealousy by always knocking #2 down whenever #2 got to an upright position. It was always "an accident". I tried everything I could think of for months, including all the above. I began to despair of #2 ever learning to walk without getting knocked down. Finally exhausting every possibility I could think of, I sat down and explained that accident or not, every time #2 was knocked over, #1 would get a spanking. I made sure #1 understood what a 'spanking' was. Sure enough, a few minutes later, #1 got their first swat on the bottom. #1 took it in stride, didn't even blink. But the second time, #1 was so offended that the behavior stopped immediately. It was truly one of the most memorable things I ever saw as a parent.
[1] DOES CAUSALLY RELEVANT RESEARCH SUPPORT A BLANKET INJUNCTION
AGAINST DISCIPLINARY SPANKING BY PARENTS?
ARE SPANKING INJUNCTIONS SCIENTIFICALLY SUPPORTED?
Comparing Child Outcomes of Physical Punishment and Alternative Disciplinary Tactics: A Meta-Analysis You might think the author is pro-spanking. He is not. This is his field of research.
For the layman: Findings Give Some Support To Advocates of Spanking For the record, I despise the teachings of Dobson and his ilk. I am not pro-spanking. But I - and my pediatrician and others - don't think one swat on the bottom in extreme circumstances is going to ruin a child for life.
Perspective taking in children's narratives about jealousy (Mostly about 5-8 year olds, but helpful info.)