I can only speculate if there is an advantage, and that it may be to hold together social bonds for humans to work better together in groups and delegate tasks. Some feelings may not be an advantage, and may either be detrimental (the reason we consider depression an ailment of a few rather than a normal trait of the majority), or neutral (no positive or negative effect, it's just there). Natural selection describes a process, not a thing with sentience to make choices, so you'll drive yourself batty if you try to make sense of it all in the context of natural selection "choosing" traits.
Some traits may simply persist because there was never another trait to replace it. Or, they may be linked to some other more beneficial trait. For example, perhaps higher intelligence that aids in survival cannot develop without the emotional centers of the brain. Emotion may not be important, but it only fails to exist in the absence of a functional level of intelligence.