What exactly is spoilage and what causes it? There are probably textbooks written about this. So, this will be just a high level overview. One way for things to spoil is through growth of bacteria. Over time, foods will breed bacteria. They will use the water in the food to drink, and proteins and sugars from the food to eat. This will eventually lead to the food breaking down into goo. It will smell bad from all the gaseous waste from the bacteria. Eating this food will lead to sickness and perhaps death due to the bacteria invasion. Some nasty bacteria include botulism and e-coli. Some of the bacteria is just from the environment. Others will be through cross contamination from your hands or counter top. Finally, there is bacteria already present within the food at extremely low levels that then multiply to toxic levels.
Another way for foods to spoil is through mold and yeast. Airborne molds and yeast which are present EVERYWHERE. They attach to the food and eat and drink just like bacteria. Most of the time, eating moldy/yeasty food will not be very healthy. Of course there are exceptions like blue cheese and penicillins. Other times the exposed area can be cut off since these generally don't penetrate very far into the food. But, that should be left for the experts!
These spoilers require a certain environment to grow. They need food, water, air, and sometimes light. They also operate in certain temperature ranges. So, taking away some or all of these things can slow or prevent spoilage.
That's what it means when foods go bad or spoil. It's the bacteria, mold, yeast, and other nasty things that will make you sick or kill you. So, it's pretty obvious why we don't want to eat spoiled food! In order to understand what the fridge does, we need to understand what it's trying to prevent.