You are asking about autophagy, a type of cannibalism where an animal eats part of it self.
Yes, this can occur in octopuses and I'm sorry to say that I have observed it myself. The traditional explanation is that this behavior is caused by stress. A few years ago two octopuses were shipped to me and they took 8 days to arrive. Needles to say they were DOA. Both octopuses had eaten some of their arms.
I've seen one of my deep-sea octopuses do this shortly after collection (catching an animal in a scallop trawl has got to be stressful!). I've also have had about 1/3 of a group of healthy 3 month old octopuses start doing this and this problem does seem more common in group cultures. Dr. Budelmann, at the University of Texas Medical Branch, believes that an infectious agent affect the octopuses nervous system and causes this behavior. I think it may be caused by any number of factors.
It is believed that it is caused by a virus/bacteria which can manage to take hold on a stressed octopus. The biting is said to be due to irritation and biting alleviates the affected area. An octopus can lose an arm without harm and regrow it. By biting it off, the octopus loses the infected arm and hopefully a healthy one regrows, but in captive situations, probably caused by bad water quality, the infection can't be shaken off. The stressed, infected octopus dies with its arms in tatters.
Are octopuses the only animals that do this? No, rats for example, will eat parts of themselves if stressed.