This type of thinking was a response to what Smith, Locke, Malthus, and others (notably David Hume and Thomas Reid) saw as faulty attempts to theorize about political, moral, and ethical questions. Surveying the errors of various social theories, they saw, as Prof. Paul A. Rahe writes, people mistakenly thinking that
political and moral obligations have their foundation in a crass calculation regarding one's own security and material well-being, in a self-forgetting passion for the public good, or in a heroic and selfless will informed by the categorical imperative.
Such notions are both incorrect and doomed to failure, as both reason and experience show, because pure self-interest as a motivation will not sustain a society, because passion for the public good is easily fooled into destructiveness, and because the categorical imperative will instruct about what is right but cannot motivate.
Adam Smith, in place of these failed ethical frameworks, proposes something more subtle: a theory grounded
in the human capacity for sympathy and the natural human desire to garner respect and be genuinely worthy of it.
There is both a hint of selflessness and a bit of self-interest here: this mix is perhaps more realistic about human nature.
Morality is neither selfless nor what we would call selfish, but it is self-regarding. Men, as Smith understands them, are not isolated operators who calculate their interests. They make their way within civil society, and they are embedded in a social nexus in which they find that they have obligations.
Smith rejected naive utopianism, and instead looked for practical ways in which we could make the world, not perfect, but good enough to maintain a just society.