I've heard this word used quite a few times now, and I'm tired of pretending to understand it. Why does 「やきもち」 refer to being jealous? Is this a slang word? How do people use this word?
The やき of やきもち can be written in two ways, 焼く and 妬く.
Assuming you know the former(焼く), 妬く can mean to be jealous. So, the word is a play on words that have the same sound. The もち part, meaning rice cake (餅) is said to come from 気持ち, in other words やきもち originated from the phrase 妬く気持ち (whether もち actually originated from 気持ち or not is unclear though).
Sometimes you will see it written as カタカナ (ヤキモチ) and young people often use it. For example:
私の彼氏は超ヤキモチ焼き <-- As if spoken by a young female
However, this word has existed for quite some time, so I wouldn't consider it to be slang.
Why does 「やきもち」 refer to being jealous?
yakimoti has two meanings: 1) a grilled rice cake, and 2) jealousy. It took on the second meaning due to the fact that yak-u means (among other things) "to be jealous".
(Note that "jealous" is an adjective, while yakimoti is a noun. As such, jealousy (noun) is more appropriate.)
Is this a slang word?
No. It has been a well established word for several hundred years.
How do people use this word?
Usually in the form of "~ ni yakimoti wo yaku".
For more information, the Kanji root of the word is 焼 which means: bake, burning.
When you are jealous, you feel it burning inside you, right?