I would suspect for the same reason you often marinade steak or meats in onions.
According to the answer onions contain proteolytic enzymes which are natural tenderizers, by breaking down proteins into smaller polypeptides or single amino acids, common in natural processes like digestion.
From Wikipedia
A protease (also called a peptidase or proteinase) is an enzyme that
catalyzes (increases the rate of) proteolysis, the breakdown of
proteins into smaller polypeptides or single amino acids. They do this
by cleaving the peptide bonds within proteins by hydrolysis, a
reaction where water breaks bonds. Proteases are involved in many
biological functions, including digestion of ingested proteins,
protein catabolism (breakdown of old proteins), and cell
signaling.
It is easy to believe these would have on octopus flesh a similar effect that they have on other meats. Whether it is significant or not may be open to debate, some times old traditions tend to stick around even after being debunked as myths.
Keeping the skin on is probably just a practical consideration for preventing it from breaking into pieces and spreading all over, as well as easier removal.
Like other seasonings it probably also imparts some flavor, even if residual, which some people might find pleasant, adding to the advantages.