I have heard people talk about how emotions aren’t rational and that they get you into trouble. I have heard people talk about them as weakness or as a character defect. But I see emotion differently. I think that emotion is neither “good” nor “bad.” It is instead useful and functional.
Every emotion is a message. Our senses receive information about something that is happening in our environment or about some feature and our brain makes a prediction, based on past experience, about what is likely to happen next and what we need to focus on to meet the present need. Then it sends a message in the form of an emotion to our conscious mind. For example: when standing near a cliff you might look over the edge. The brain evaluates the situation and gives you a feeling of emptiness in the pit of your stomach, increased heart rate, shallow breathing, or other physical sensations associated with fear. That is the message that says “Hey! Pay attention! There is something that could hurt you.” Likewise, joy gives the message to “Pay attention! We like this. Do this again.”
When we receive the message that emotion is sending, we have a couple of options for resolving it. We can do what it is asking or we can reinterpret the message. In the case of the cliff, one option would be to back away and put ourselves in a situation that we perceive as safe. Alternatively, we could put on a repelling harness and go over the edge. This second choice requires a reinterpretation of the physical sensations(ie changes in heart rate and breathing) from scary to exciting.
For more on how your brain creates reality, take a look at the work of Lisa Feldman Barret on her website https://lisafeldmanbarrett.com/