Is chocolate poisonous?
Alkaloid synthesis is energy consuming for plants and have complex metabolic pathway. 

If their evolutionary history is not known with certainty, they have numerous uses and are often toxic to potential plant or animal aggressor.


Chocolate contain many alkaloids including caffeine and theobromine. But apparently do it with a different pathway and is the result of convergent evolution.

It is safe to assume these alkaloid protects cocoa plant in the same manner it protects coffee and that the benefits of such poisons allowed poisonous cocoa plant to become predominant.

However, alkaloids of chocolate are solely responsible for its bitter taste. (Cf. Wikipedia page "Alkaloids" for more info).
If bitterness is part of its flavour, we prefer its fats the numerous volatile compound gained during fermentations of the beans. According to this article published on academy.org :


  The distinctive chocolate flavor evolves throughout its production. Odorless, tasteless “precursors” form during fermentation, and these precursors react during roasting to form taste and aroma compounds.


Also many essential oils are poisonous to insects, fungi or bacteria. These properties are sometimes used by humans : for instance cinnamon oil is toxic to mosquito larvae