Why does rice cooked in the rice cooker spoils?

Rice doesn't spoil until it has grown mold or bacteria in it. If you mean to say overcooking, then it is either due to too much water in the rice, or too long of cooking time.