A dog that leans into you is not being clingy for the sake of it. The behaviour has a physical logic behind it: dogs seek pressure against their bodies as a way to regulate their own arousal state. The same mechanism that makes a snug wrap calm an anxious dog at the fireworks is at work when your dog presses its flank against your shins and stays there. It is not random, and it is not simply about love, though the two can overlap.
What the lean is actually communicating
Most leans fall into one of three categories, and they look nearly identical from the outside. The first is affiliative contact, the dog is calm, its body is loose, and it is choosing proximity the way a person might rest a hand on a friend's arm. The second is appeasement or reassurance-seeking: the dog is mildly uncertain about something in the environment and is using your body as a reference point. The third is a resource-guarding lean, where the dog is positioning itself between you and another person or animal. Body language separates them. A relaxed lean comes with a loose jaw, soft eyes, and a tail that wags in a slow, wide arc. An anxious lean comes with a tighter body, ears pulled back, and a tail that may be low or tucked. A possessive lean comes with a stiff body, a fixed gaze toward the third party, and sometimes a very still tail.
Why some dogs lean more than others
Breed history shapes the habit. Dogs bred for close work with people, herding breeds, mastiff-type dogs, many of the companion breeds, have a stronger default toward physical contact with their person than dogs bred for independent work, such as sighthounds or many of the Nordic spitz types. That said, individual dogs within any breed vary considerably. A Greyhound that grew up in a home where leaning was met with warm attention will lean more than a Labrador that was consistently moved away. The behaviour is shaped partly by genetics and partly by what the dog has learned works.
When the lean is worth paying attention to
A lean that has always been part of a dog's normal behaviour and stays consistent is not a concern. A lean that appears suddenly in a dog that did not lean before, or that becomes more frequent and urgent over weeks, is worth examining. Pain is one driver: a dog with joint discomfort or an internal problem may seek contact more than usual because pressure and proximity are regulating. Cognitive changes in older dogs can also increase contact-seeking. If the lean is accompanied by other changes, reduced appetite, altered sleep, reluctance to move, or changes in how the dog interacts with familiar people, a vet visit is the right next step rather than a training adjustment.
What to do about it
If the lean is calm and affiliative, there is nothing to fix. Enjoying it is a reasonable response. If the lean is anxiety-driven and frequent, the lean itself is not the problem, it is the dog's baseline stress level that needs addressing, and that is a job for a qualified trainer or veterinary behaviourist, not for pushing the dog away each time it makes contact. Pushing a stressed dog away removes the coping behaviour without addressing what the dog is coping with. If the lean is possessive, body stiff, gaze fixed on a third party, that is resource-guarding behaviour, and a qualified trainer who works with reward-based methods should be involved before it escalates. Suppressing the lean in that context without professional guidance can push the behaviour underground without reducing the underlying tension.