Why do only corpses of species rot and be eaten by bacteria? What is keeping us from rotting? Just like fruits, and foods we eat; meat and vegetables rot when left uneaten. Like food, corpses rot and get eaten by maggots. Why? Why don't these apply to living species?
One can calculate that there are more non-human cells (mainly bacteria) inside human body than there are actual human cells. Why those bacteria don't eat us from within? Epithelium is pretty good barrier between outer world and internal systems. It is essentially one-cell thick layer that protects internal organs and infrastructure. In cases when epithelium breaks, bacteria can get into blood stream and start very bad infection, which can cause necrosis (effectively, rotting, tissue decay). Natural cell death is fought by natural cell proliferation so that there are no gaps in defense layers.
Also one should not forget about immune system that is looking for invaders or anything that should be where it is. In healthy person immune response will close gaps in epithelium and kill bacterial infections pretty quick.
Dead people, as well as dead plants, have their skin and epithelium, immune system destroyed by cell death or infection. Then bugs start to eat vessels, tasty nerve tissues, muscle and cartilages, blood cells filled with proteins and everything eatable.
What's rotting mean?
The stages of rotting or decomposition are Fresh, Bloat, Active decay, Advanced decay and Dry/remains.
Fresh decomposition is first and is typically required before the other stages. It is caused by failure to remove carbon dioxide (which makes things acidic) and provide oxygen to tissues (because the hearts stopped for example). There's lots of bacteria in us but they're kept in check by our immune system and also the presence of oxygen (a lot of them are anaerobes which dislike too much oxygen). They start eating are carbohydrates, fats, protein and making chemicals such as acids, gases like methane and ammonia. Multiplication of these bacteria and continued production is called putrefaction and leads to the next stages.
So in summary it's the cell barriers, the oxygen and the immune system stopping this first stage from happening (which let's the next insect stages occur).
Rotting in living organisms
Sometimes this can happen in living organisms such as in gangrene where parts of the body (typically the toes or fingers) aren't getting oxygen and then rotting can occur in a living organism. It's a great idea to then chop off the affected part before these bacteria eat into a blood vessel and spread throughout the body.