Sleeping bags temperature rating are provided by the manufacturer and are usually based on the EN13537 standard as a way of being able to compare the rating.
Bags are grouped by their Limit of Comfort which is the lowest temperature that an average person should be able to maintain their temperature, and so be able to sleep. This is the lowest temperature that a sleeping bag should be expected to usable, but the user should expect to wear clothing inside the bag, such as a hat, gloves, thermal base layer and maybe even a light down jacket. The exact ability of a bag to perform depends on the fit of the bag, the atmospheric conditions (humidity) as well as the level of fitness of the user and even what they have had to eat.
Two other temperature ratings are generally provided:
Comfort Temperature: An average user should be very comfortable with little or no extra clothing required.
Extreme: In the words of the EN standard “In this range, a strong sensation of cold has to be expected. There is risk of health damage by hypothermia. A sleeping bag should only be used in this range in an emergency.” In short, the bag will keep you alive, but don't plan on sleeping at this temperature with this bag!