Origin of alternate meanings

One of the ways that new meaning comes up is through usage. Alternate meanings come from change in meanings due to the way its used. Let's take the word you gave, cool. Originally meant to mean moderately cold, if someone wasn't excited, or someone was calm and had good control over himself, he was said to be "cool as a cucumber", that is, not easily excited. Thus, an alternate meaning of cool came from describing a person who did not get "hot" in an exciting occurrence, or debate, etc.

Then, as time wore on, someone who could hold his nerves was looked up to, and someone who was "cool" soon began to mean something more of the, "admirable"(e.g. "That car is cool".

Thus, we can kind of slowly trace the alternate meanings in a word. But they're different for every word.

The main thing that influences them however, is what they're used for, and the environment around usage.