Just guesstimating from the image since I wasn’t able to find footage of it in motion.
But it looks like it’s basically the same as doing rope physics. The ends are fixed and everything in between sag with gravity. There are other posts on that but the method I’m fond of is to make all the non fixed segments accelerate downwards, then starting at base check the distance between each pair of segments and move toward each other if too far apart. A last step would be to update the velocities after that position correction. That may not be Strictly needed, depending on whether you wanted momentum or not.
So anyways you’d have the head move on a path, then the body would move with the rope physics. Maybe letting it move the head so it can’t stretch too far.
Beyond that there may be some more artistic setup with it. Instead of a limp rope between the head and base there may be a way to make some sections more stiff to simulate contracting muscles. That or just adding a lot of damping to the motion so it doesn’t seem as loose.
I’d wager they did something more simple than all that though. For example you could position the body segments between the head and base with cubic() to make them curved. You just need two other points moving around too to define the curved shape. The gaps between adjacent segments may vary though.
I suppose you could also do it by varying the angle from one segment to the next with a formula of some kind. It would require some tuning as the final head position would be defined by it, instead or the more direct approach the other ideas have of moving the body between the head and base.