Because you live in a comfortable place.
Earlier we talked about why ice and snow melt. The same processes (of equilibrium at a given temperature) occur in most materials. When the temperature rises above the melting point, molecules leave the solid and enter the liquid at a faster rate than the molecules in the liquid crystallize onto the solid.
The fat in cocoa beans (called cocoa butter) melts in a small temperature range, between 93 and 100 degrees Fahrenheit (34 to 38 Celsius). Normal human body temperature is in this range. So if the temperature is hot enough to melt chocolate, you body has a hard time staying cool, and you move into the shade.
Part of what we like in chocolate is that it is a solid in the wrapper on the table, but becomes a soft paste or liquid in the mouth.
Other fats have different melting points. Tristearin is a hard waxy fat that melts at 154° F (68° C). Triolein, which has three kinks in the molecule, so it can’t form compact crystals as easily as tristearin, melts at 41° F (5° C).
Tristearin
Cocoa butter has a mix of fats, but is made mostly from the fatty acids stearic acid, palmitic acid, and oleic acid, sometimes on the same glycerin molecule, as shown below.
Coco butter tryglyceride
This arrangement gives it a melting point in-between that of the solid tristearin and the liquid (at room temperature) triolein. So our chocolate bar stays solid as long as we don’t leave it out in the sun.