The Lord is my shepherd, I shall not be in want.
He makes me lie down in green pastures,
he leads me beside quiet waters,
he restores my soul.
He guides me in paths of righteousness
for his name's sake.
Psalm 23:1-3
Our Shepherd provides guidance. Like you and me, sheep settle for dry stubble and stagnant, polluted water if the shepherd doesn't guide them to green pastures and quiet waters.
Just like a shepherd leads his sheep, God leads us past the life we'd choose, past situations we'd get ourselves into ... sometimes even past a beautiful oasis that appears to be able to bring happiness and peace.
Remember that God's goal for his children is righteousness not a comfy, happy life.
Righteousness in verse 3 means right, in the sense of straight, the path that brings the sheep most directly to their destination. Philippians 1:6 tells us that we can be confident that God, who is working in our lives to make us more like Christ, will not give up on his children. Instead he will "carry [this work] on to completion until the day of Christ Jesus."
"God did not call us to be impure, but to live a holy life." (1 Thessalonians 4:7)
It may seem rather impossible but the Bible assures us of the opposite: "His divine power has given us everything we need for life and godliness through our knowledge of him who called us by his own glory and goodness. Through these he has given us his very great and precious promises, so that through them you may participate in the divine nature and escape the corruption in the world caused by evil desires." (2 Peter 1:3)
And why does he guide his children in paths of righteousness? for his name's sake
For the sake of his glory and reputation. If his goal is for none to perish and all to come to repentance (2 Peter 3:9), then he has to take care of us and guide us. Others are watching. He wants to show the world that he is faithful to provide all the needs of his children and to guide them in righteous paths.
The Psalmist emphasizes his point in Psalm 18:30-36.
As for God, his way is perfect;
the word of the LORD is flawless.
He is a shield
for all who take refuge in him.
For who is God besides the LORD?
And who is the Rock except our God?
It is God who arms me with strength
and makes my way perfect.
He makes my feet like the feet of a deer;
he enables me to stand on the heights.
He trains my hands for battle;
my arms can bend a bow of bronze.
You give me your shield of victory,
and your right hand sustains me;
you stoop down to make me great.
You broaden the path beneath me,
so that my ankles do not turn.