Rather like a dummy dance-partner, your car should always be under your control, like your dog. (Of course, you can take the car/dog "off-road", and let them go, but on the public highway—where other, larger vehicles/dogs may get close—you're supposed to be the one in charge, controlling when/where it goes).
Dogs have a mind of their own. Cars too, sometimes … at least it feels so. You can tell what they want to do through the lead (= the pedals/steering). Sometimes you let the lead go slack (= clutch down), sometimes taut (= brake on).
When you stop, putting the handbrake on is like making the lead go stiff, so the dog stays where you made it stop, even if a bigger dog bumps into it.