Emotions are defined as a "
complex reaction pattern, involving experiential, behavioural, and physiological elements". They arise as a result of a subjective experience leading to a physiological response and a behavioural response. Feelings are something that arises from conscious emotional experiences.
Emotions are something that stem from neural activity from specialized neurons in certain parts of the cerebral cortex, such as the amygdala, the ventromedial prefrontal cortex, the ventral tegmental area, the putamen, etc. They are something that evolved because they better addressed problems with the ever-changing environment comparisons to just relying on reflexes alone. There has also been some speculation that they may have arisen from reflexes that were "decoupled" in order to include another layer of nerve cells on top of them.
The types of emotions you are able to experience also seem to develop throughout your life. For example, early on, infants are only able to experience the dichotomy between pleasure and pain. After the first year, the range of emotions that can be expressed and felt becomes larger and more complex. From birth up until 7 months, babies can only express very basic emotions, such as disgust and contentment. By 2 to 3 months they start to show social smiles (interesting thing to note is that social smiles can act as a form of operant conditioning, with them being used as a positive reinforcer to get their caregivers to perform desired behaviours for them) and by around 2 to 7 months they start to express more emotions, such as anger and fear. Emotional development coincides with other parts of cognitive development. For example, to feel anger (something that is felt when things get in the way of our goals or wants) you have to have the ability to understand that your actions can affect the world around you. By 18 months, an infant now has the ability to feel more complex emotions that require an understanding of social context and self, such as jealousy and embarrassment.
I don't think I did a great job at addressing your question (mostly due to laziness and stupidity) so I'd suggest just reading the shit I linked to in my post. They do a much better job at explaining this stuff (especially the ncbi article).