I’d say largely ones’ family and upbringing
Discussion
Plus human nature or not ?! Sure there is a spectrum, but in principle…
Upbringing is also experience. Values, or preferences, are something that is also learned through experience. Even genes are experiential, but on a different time scale.
I would say that a wise person has learned to align their internal preferences and values, with a value set of their niche socioeconomic environment.
Figuring thatbout is difficult, thus takes time, and a lot of life experience. It is not a coincident that old people are seen usually as wiser than young ones.