It sounds like your daughter needs firm and consistent limits at both home and school. Kids don't know it, but they need limits to make their overwhelming environment more manageable. Think about how much they still have to learn about in life and how many new things they experience each day. Setting limits can make it less overwhelming and less of a huge 'task.'
You could decide together what the rules in the home are going to be. Let her know what the consequences are if she does not follow the rules, then follow through with the consequences. Tell her, though, that you don't expect it to be a problem and that you are sure she can follow the rules you both have decided on (this shows her that you have high expectations for her).
Logical consequences are best. Make sure she can make a connection between the misbehavior and the consequence. ex. if she hits a friend, then she needs to help the friend feel better, and then be removed from the situation and find another activity.
Make sure you remember to focus on the positive times and her good behavior, too. Be silly with her and act like a kid yourself! Always nagging at her will all start to sound the same and she could stop paying attention to it. In your reaction to her behavior, make sure you create a contrast between the times she is behaving appropriately and when she is not.
As for the whining and wanting her way, you need to be consistent and tell her every time that she needs to use her "big girl voice" when she talks to you and you can't hear her when she whines. (Make sure you don't whine when you talk to her as well). You may need to give her an example of what it should sound like.
Teach her more acceptable ways of handling her emotions when she does not get what she wants. You could say, "I'm sorry you're upset. I can't let you___, but you can____" Give her an alternative. For example, "I can't let you have candy at the store, but we can have a snack when we get in the car. Would you like granola bars or fruit?" It may not be what she wants, but if you give in to her throwing a fit, she will learn that all she has to do is throw a fit to get what she wants. You have to be very consistent with this. She needs to know that it's OK to feel sad, angry etc. but there are acceptable and unacceptable ways of handling her emotions.
I would also sit down with her teacher to talk about her behavior at school. Find out what the teacher does when she misbehaves. Whatever the teacher is doing, it sounds like there may be a better way. Most of the time when there is a behavior problem, it is because the child is not getting something they need. It could be they need more one on one attention, more limits (like I described above), a stronger parent/caregiver bond, more stimulation, more structure, etc. Hopefully, you and the teacher can figure it out together.
You also may need to find out if there are any patterns in the misbehavior. Is it always the same thing? same time of day? with same peers? As adults, we have to remember that kids don't automatically know everything we expect them to know. Most things have to be taught. You can't expect a child to act appropriately if no one has taught them which behaviors are ok and which are not. For ex. many kids will go up to a group of kids and act mean or disruptive when they want to play with them. They don't know how to approach the group, and that is their way of asking if they can play with them. Someone has to take the time to help them learn how to ask a group of kids if they can join them. With your daughter, she may just not know what the right ways to behave are.
Sorry this is so long, I just wanted to cover several of the reasons that the misbehavior may be occurring. I work with kids and families at a child development center and have a master's degree in early childhood education, so I have a lot of experience with this type of situation. If you would like to talk more specifically about your daughter's situation and what exactly it is that she needs to help her succeed, I would be happy to talk with you further.
Best wishes, C.