Why did Jesus say, "No one is good but God alone" if He is God?

Why did Jesus say, "No one is good but God alone" if He is God?

When Jesus said, “No one is good but God alone,” He wasn’t denying His divinity—He was confronting the rich ruler’s shallow idea of goodness and exposing his heart’s true loyalty. By calling the man to abandon his idol of money and follow Him fully, Jesus revealed both the man’s heart and His own divine authority as the giver of eternal life.