https://books.google.com/books?id=Tun_DwAAQBAJ&lpg=PA61&dq=O...
Eating your tentacle is a net negative in "calories" long term, and there is probably the opportunity cost of not having said tentacle (for some time?)
I guess maybe they want a quick snack for the high energy jet propulsion predator escape that they are preparing for when stressed.
But then Hesoid is kid of right, they do eat it because they need more energy.
Evolution predicts that self-harming behaviour will be observed less frequently compared to self benefitting behaviours.
So whenever an apparently self-harming behaviour is observed it is quite useful to ask: "is it really self-harm or secretly useful somehow?". And also: "how often does that really happen?"
I don't see why this is a surprise.
But more to the point, if somebody from a coastal, extensively seafaring culture 2700 years ago says octopi sometimes eat their own tentacles, there is every reason to believe he's saying it because it's true. The options are (I) octopi sometimes eat their own tentacles, as advertised; (II) octopi sometimes engage in a behavior that looks very similar to eating their own tentacles, but is subtly different; or (III) someone made it up and nobody in a culture with extensive exposure to octopi ever noticed that it never happened.
Incidents of type III are far from unheard of -- I have a dictionary with the Tongue Map printed in it -- but they're not the way to bet.