From an evolutionary perspective, emotions have developed as important tools for survival (in both humans and other animals). Fear guides you away from situations that could be dangerous to your survival, anxiety can make you think twice instead of acting on your knee-jerk impulses, and comfort, satisfaction and pleasure result from having basic needs met and encourage us to seek out more. Happiness is a more complicated case because what makes one happy varies from person to person, but I think some of the most common things that lead to happiness are forming connections to others and feeling you're somehow contributing or making a mark, and for obvious reasons forming strong bonds with others rather than being totally solitary was important to survival before modern society. I've read an interesting theory that altruism among one's group/inner circle arose for this reason -- group members putting the needs of other members before their own ultimately helped make the group stronger and more cohesive, which led to a higher chance of survival for most individuals within the group. Unfortunately, I think the human tendency towards tribalism and forming in-groups is the flip side of this -- especially when resources were scarce, being willing to ignore the needs of, or even being willing to take from, others who aren't part of the group may have been necessary to the survival of one's own group.
And of course, aside from their evolutionary, utilitarian purpose, certain emotions can both in themselves greatly contribute to our higher sense of meaning (especially love and wonder) and serve as an important part of what guides us toward what is meaningful. Although I don't believe emotion is the sole thing that guides us or gives life meaning (in my opinion intellectual understanding is important in these regards too) life would be very dull and flat without it. (Of course, emotions can also be completely misguiding and maladaptive and cause us to act in ways in the short-term that will ultimately be harmful to self and/or others, but I won't get into that.)