Domesticated dogs co-evolved with humans, meaning the species would not exist if it weren’t for humans. Likewise, humans would likely be very different without dogs.
Wild canids probably followed our ancestors while hunting, and assisted humans in catching large prey. (The start of hunting/herding).
They also lingered on the outskirts of human encampments, cleaning up the food scraps and waste left by humans. This benefited humans by reducing the spread of infection and disease. This hygienic action may have permitted early humans to remain settled in one spot rather than having to continue relocating after they had polluted their site.
While hanging on the outskirts, dogs also functioned to protect the humans from other, larger predators.
When humans saw the benefits that dogs provided, they probably gave them leftover food, which directly benefited dogs. They also probably cared for stray puppies, which increased the bond.