Two things are usually to blame for the chain coming off the cogs. Ist is an improperly adjusted limit screw on the rear derailleur. Lots of novices like to fool with these for some reason. The other is a bent DR hanger.
Easiest to check for either condition with the chain off; you should easily find derailleur setup instructions on the Park Tool site.