Evolutionists would say natural selection explains best, along with random values, beliefs & behaviors
B. F. Skinner would argue for negative & positive reinforcement
Child psychologists would attribute or blame the parents for how the kids turn out. Parents would blame schools and television & movies.
A "bad" neighborhood with street gangs can corrupt most youth in the area.
You tend to have values & beliefs that are an average of the 5 people closest to you. You influence your friends and associates, and they influence you.
But we're all capable of rational thought, reason & logic, which can override any other influence. But few of us approach being Dr. Spock, except maybe Prof. Sheldon Cooper, sometimes. And he can't escape being a nut case, a lot of the time