This parable was given in response to the religious leaders rejecting Jesus’ authority. Through this parable, Jesus reveals God’s rejection of the Jews in response to their rejection of His Son. Jesus is showing that those who do the will of God are actually the ones invested with God’s authority.
These leaders had a form of godliness like this second son, but they were not doing the will of God. The publicans and harlots had no form of godliness, but when confronted with the preaching of John, many of them repented and began to do the will of God like the first son in the story.
These religious Jews, who sat in the seat of Moses, disqualified themselves from being God’s representatives here on earth, because of their hypocrisy and hard hearts. Even the publicans and harlots, who repented at John’s preaching, were ahead of them. There is no sin more frequent among religious people than that of self-righteousness; that is to honor the Lord with the mouth when the heart is far from Him.
These sinners were entering the kingdom of God ahead of the very religious Jews because they knew they were sinners and they put their faith in a Savior. One of the deadliest things about religious self-righteousness is the deception that we will be saved because of our good deeds. We cannot save ourselves regardless of how good we act. Who wants to be the best sinner that ever was sent to Hell?