Depending on who you ask, you might hear that “Chocolate appears to promote the neurotransmitter serotonin release as well, thereby producing calming, pleasurable feelings,” (Chocolate as Medicine).
Hernando Cortés, the Spaniard who took control of the Aztec empire, also noticed it’s stimulating effect, saying that “A cup of this precious drink permits a man to walk for a whole day without food.”
The general sense of positivity might come from biogenic amines like phenylethylamine or the cannabinoid anandamide, while theobromine is almost certainly the stimulant. There’s probably also a psychological component. Chocolate is associated with holidays and special events, love and happiness. Those associations inform the feelings we experience when we eat chocolate, in addition to whatever chemical effect it has.
If you want to improve your mood with chocolate, you should know that the effect probably won’t last. At least one researcher has found that while people enjoy anticipating and eating chocolate, that pleasure doesn’t negate depression and it is often followed by guilt.