Octopuses require very specific water chemistry that is easily messed up during the shipping process. Some animals can ink when they are in transit and they will almost always be dead upon arrival when that happens. Other times, the temperature of the water in the box can heat or cool outside of the bounds where the animal can survive, and that can cause it to die as well.
As for the short lifespan of the animal- most cephalopods only live to be about a year old in general, so when an adult is captured from the wild and shipped to a home aquarium, they may only have a few months of life left anyway. These few months can be shortened by non-proper water chemistry in a home aquarium which is why some people only have octopuses that survive for a few months/weeks.