By - PeanutSalsa
The same reasons humans do. To protect them from bacteria, drying out, bugs, etc. Fruit is designed to attract animals for seed distribution primarily. That doesn't happen if it's rotten, completely dry, or insects have eaten all of the meat.
It's an evolutionary advantage that's come about through random genetic mutation over millions of years