This verse does not stand alone. As is the case with many of the proverbs the entire thought is expressed in two (or more) verses:
The king's heart is a stream of water in the hand of the LORD; he turns it wherever he will. Every way of a man is right in his own eyes, but the LORD weighs the heart. - Proverbs 21:1-2
These verses highlight two critical features. 1) The ability of humans to choose for themselves, 2) God's sovereign ability to judge and use those choices as He wills.
The King's heart is like a stream of water; it has an energy and a direction. The way that he directs that energy is what he has determined (in his own eyes) to be right. However, it is God and not man who is in charge of the ultimate outcome.
We see this very clearly demonstrated in the story of Joseph (Genesis 37-50), whose brothers sold him into slavery. Years later those same brothers found themselves standing before Joseph who was now high in command of Egypt. Through all of the difficulties he endured due to his brother's evil intentions Joseph was able to see that the sovereign hand of God had orchestrated a plan to rescue his father's household from devastation by famine, and he famously said to them:
As for you, you meant evil against me, but God meant it for good, to bring it about that many people should be kept alive, as they are today. - Genesis 50:20
And we now can look back and see how this deliverance from famine became slavery in Egypt, which became deliverance from Egypt, which became the establishment of Israel, which became the advent of Jesus Christ, the world's Savior.
Evil was intended and God brought forth good, indeed.