seely -
you replace your chain, cog, and chainring together if you've been riding a stretched out chain for a while, or you ride hard.
the reason being, that as a chain gradually lengthens as the pins wear, it begins to wear down the cog and chainring, because the rollers are farther apart than the distance between the teeth of the cog or chainring.
now, when you throw a brand new chain into the mix, since the sides of the teeth of the chainring/cog are worn away, they can not engage the chain as solidly. what then happens is that the chain slips off, as in your case. what can complicate this issue, is that the cog and chainring can wear asymmetrically, which means that when you replaced your chain, the worn sides of the chain and the cog could have become offset differently, increasing the chance for a throw.