Same as why apples, or any other fruit, will rapidly turn brown/black.
When part of the fruit starts to decay, it will give off signals (I believe, at least with bananas, it is the gas ethylene), which tells the neighbouring parts of the fruit (as well as any fruit nearby) that it is time to die.
I suspect it would be part of the process of returning nutrients to the soil (these being fruits that have not been eaten by animals, and thus have lost their usefulness - which was to entice an animal to eat the fruit and carry the seeds and deposit them in some distant parts).
I am not aware of any toxins the bruised fruit, but since most people (myself included) seem normally to avoid eating bruised or rotting bits of fruit (excepting the use of such for alcoholic beverages - flies can get intoxicated by the alcohol in rotting fruit), I am not sure why that would be so if there were no toxins.http://www.ephidrina.org/alcohol/history.html
Higher primates, such as chimpanzees, will eat rotting fruit to enjoy the "high" from their fermenting juices. It's therefore pretty safe to assume early Man did, too. The process of sugars fermenting into alcohol occurs regularly in nature through contact with airborne yeasts. But alcohol use would not have begun in earnest until the dawn of agriculture. Most sugars are simply not abundant enough in nature to make serious production worthwhile, so we probably began farming before we began brewing.http://www.news-medical.net/?id=12390
The scientists say that in nature, fruit flies are often exposed to alcohol in rotting fruit, and there is strong evidence to suggest that the drug has a similar effect on the insects.
Heberlein says that when flies are exposed to ethanol vapour, they become hyperactive, uncoordinated and eventually sedated.
In another discovery the research team found that, as well as making the flies more tolerant of alcohol, the hangover gene appeared to influence the way the insects responded to stressful conditions in their environment, such as increased temperature.