What allows both species to survive is the fact that they have the characteristic of forming endospores, which are very resistant. In food, these endospores germinate and bacterial multiplication begins. In this occurs the formation of toxins - botulinum toxin (C. botulinum) and enterotoxin perfringens (C.perfringens). Both species produce more than one type of toxin, but these two are the ones that cause foodborn disease.
Botulinum toxin is destroyed by heat and the endospores of C. perfringens can survive cooking.
In the case of foodborne infection, botulinum toxin is a neurotoxin because it causes flaccid paralysis, affecting breathing and heartbeat functions. And when it reaches the motor plates of the nervous system, they prevent the release of acetylcholine.
Enterotoxin perfringens causes diarrhea, vomiting and intestinal cramps.
Clostridium species produce spores which provide resistance to heat, desiccation starvation and many other environmental stresses. It's the heat-resistance that is usually the significant issue in food processing. If the spores survive the heat process and the food does not contain growth-inhibitors, the spores can later germinate if this food is held at a temperature supportive of growth. For this reason canning processes are designed and validated to eliminate 10^12 spores of C. botulinum - the so-called 12D or "Bot cook". This approach is so well established that botulism is now exceptionally rarely associated with commercially processed foods.
Another feature of Clostridium species is that they are anaerobic, so they grow where oxygen is excluded. C. perfringens food poisoning tends to be associated with large joints of meat that are not cooled quickly enough after cooking. United States Department of Agriculture Food Safety Inspection Service (USDA FSIS) has rules governing heat-up and cooling times for food processing.
Note that even though your question asked about foodborne disease, Clostridium perfringens can cause gas gangrene in an infected wound.