Once the can is sealed it creates an oxygen-free environment. The can is then heated, and if heated properly the spores die. If not heated properly, however, the spores activate in the sealed can and fill it with toxin. Because botulin is a protein, heating will destroy it. But if the canned food is eaten cold, botulism occurs.
Babies get botulism from honey in a different way.
Bees naturally collect botulism spores as they are collecting nectar and mix them into the honey. Most people can eat these spores without difficulty because we have bacteria in our intestines and robust immune systems that eliminate the spores. Infants do not yet have these defenses. So when a baby eats honey the spores find themselves in the oxygen-free intestine and come to life. They produce the toxin while inside the baby.