Isaiah 26:9 AMP
My soul yearns for You [O Lord] in the night, yes, my spirit within me seeks You earnestly; for [only] when Your judgments are in the earth will the inhabitants of the world learn righteousness (uprightness and right standing with God).
Why do our souls yearn to do right thing? The Lord our God formed us from the dust of the Earth we are made in his image, meaning we are replicas of him in our core being. There is something in our dna even for the worst of mankind that for even a split second we fight with the evil in us to want/desire to do good.