Basically because we domesticated them and started to selective breed for traits that we (the human race) wanted, based on where we were living and what we wanted them to do (hunt, protect sheep, be cute and cuddly, catch rats etc). It is just a large unsupervised breeding program by humans over 1000s of years.
There are over 340 breeds of dog, most of which have been selectively bred for desirable traits over the last 200 years. In more recent times designer dogs like the labradoodle, a cross between a labrador and a poodle have become popular. Unfortunately for every crossbreed that is successful, dozens more result in dogs with birth defects. Not a great start in life 🙁