Since it is an extension of the cecum, an organ well developed in plant eating animals, it had necessary beneficial intestinal bacteria that helped in digestion of plant material.
Evolution has made this redundant in humans as humans cannot digest plant cellulose. So it was thought as a vestigial or useless organ.
But now new theories are emerging that suggests that the appendix has abundant normal gut flora (beneficial bacteria) that maintains the equilibrium between the good and bad bacteria. Appendix can supply useful bacteria in case of diarrhea or gut infection. So the notion that it is a useless organ is not really valid.