There are many methods of dog training and many objectives, from basic obedience, to specialized areas include law enforcement, military, search and rescue, hunting, working with livestock, assistance to people with disabilities, enertainment, dog sports and protecting people or property.
As pack animals, wild dogs have nautual instincts that favor cooperation with their fellow dogs. Many domestic dogs either through instinct or breeding, can correctly interpert and respond to signals given by a human handler.
Most dogs, no matter thier eventual advanced training or intended purpose, live with people who want them to behave in ways that make them pleasent to be around, keep them safe and provides for the saftey of other people and pets. Dogs do not figure out basic obedience on their own, they must be trained.
The hardest part of training is communication with the dog in a way the dog understands.