As owners we inadvertently encourage this behavior by occasionally allowing wriggling under you, or reaching out to pet or even pushing our puppies away when they do it. It is up to us to eliminate any reinforcement of this behavior in order to control and prevent it.
Training a non-compatible behavior is also a critical part of controlling and preventing wriggling. Think about what would you like your puppy to do when greeting you, instead of wriggling under you. A good choice would be to have her sit politely while being greeted. Work on training a good reliable sit cue in addition to eliminating unintentional reinforcement (ignore the behavior you don’t like and reward the behaviors you do like.)
– lightly edited passage from a pet-training guide