[Meditate] This passage appears also in Luke 6:43-45. One difference is the inclusion of this verse (45): "The good man brings good things out of the good stored up in his heart, and the evil man brings evil things out of the evil stored up in his heart. For out of the overflow of the heart his mouth speaks." Luke 6:46 then says "Why do you call me, 'Lord, Lord,' and do not do what I say?"
Matthew includes another similar passage:
33 “Make a tree good and its fruit will be good, or make a tree bad and its fruit will be bad, for a tree is recognized by its fruit. 34 You brood of vipers, how can you who are evil say anything good? For the mouth speaks what the heart is full of. 35 A good man brings good things out of the good stored up in him, and an evil man brings evil things out of the evil stored up in him. (Matthew 12:33-35)
Jesus warns the people to watch out for false prophets. He says that inwardly they are evil and they are headed for destruction. He tells them they can identify a false prophet by their fruit. What does he mean here? Is he talking about their words or their actions? I believe he is talking about their words (Matthew 12:34-37 and Luke 6:45), although he will then address actions in a more general sense next (see Matthew 7:21-27 and Luke 6:46-49). So two topics are in view here in Matthew 7, and I will address them separately.
(1) Watch out for false prophets; you will know them by what they say.
From Keith Krell, "The Highway to Hell," on Bible.org:
"By “fruits” Jesus is referring to what comes from the lips of a false prophet, not the life of a false prophet. This is confirmed in Matt 12:33–37 where Jesus uses nearly identical language. Therefore, Jesus admonishes disciples to be “fruit inspectors” of those passing themselves off as prophets. The Jewish audience Matthew addresses would naturally think of two Old Testament passages. One refers to a false prophet whose prophecy actually came to pass (Deut 13:1–5); the other to a false prophet whose prophecy was not fulfilled (Deut 18:20–22). In both situations, the emphasis is not on how the prophet lived, but on what he said. The people of Israel were told to observe what a prophet says and see if it aligns with what God says, regardless of any signs the prophet might perform with his prophesying. It may surprise you to know that it makes no difference whether signs or wonders accompany a prophet’s message. If his message does not agree with what God has said, that prophet is to be recognized as a false prophet. The true test for discovering a false prophet or teacher is to compare his or her message with God’s Word. This has always been the test for discovering who speaks for God and who does not. Since God cannot possibly contradict Himself (Num 23:19) and His Word stands forever (Isa 40:8), we must judge those who claim to speak for God by the Word. Fortunately, the Scriptures provide several criteria for indentifying false prophets. Deut 18:20 says false prophets speak in the name of other gods; Micah 3:11 says false prophets prophesy for money. In 1 Cor 12:3 false prophets do not confess Jesus as Lord. In 1 John 4:2 false prophets do not confess Jesus having, and remaining in the flesh. In Matt 24:24–27 false prophets do not view Jesus’ return as a cosmic event. In 2 Pet 2 false prophets have libertine ethics. We can discern whether a prophet’s message is false by knowing the truth! The FBI trains their agents to detect counterfeit bills by studying authentic bills. If they can master the genuine article they can easily pick out what is counterfeit. This is also true with false teaching. If you immerse yourself in the Scriptures and biblical teaching, you will be able to ferret out what is false. You don’t have to be a “cult expert,” you just need to be a diligent Bible student."More on false prophets: 2 Peter 2:1-3, Deuteronomy 18:21-22, Luke 13:25-27. Also Deut. 13; 18; Jer. 6:13-15; 8:8-12; Ezek. 13; 22:27; Zeph 3:4.
"...24 out of 27 New Testament books warn believers against false teachers." -Keith Krell, "The Highway to Hell," from Bible.org
19 The end of 'every tree that does not bear good fruit' is 'the fire.' -Dr. Constable, Study Notes on Matthew: 2013 Edition, 128.
"In Matthew 24:24, Jesus states that false prophets may be able to perform such marvelous signs and wonders that even the very elect are almost deceived. The Antichrist himself will have miraculous powers (2 Thessalonians 2:9). Even Balaam’s donkey demonstrates that the devil can produce imitations." -Keith Krell, The Highway to Hell, from Bible.org
(2) Only those who do the will of God will enter the kingdom.
Krell had something interesting here, which I'll add:
"Jesus uses the phrase 'the will of My Father' in John 6:40 where He says: 'This is the will of My Father, that everyone who beholds the Son and believes in Him will have eternal life, and I Myself will raise him up on the last day' (cf. 6:28–29)." -Keith Krell, The Highway to Hell, from Bible.org
Which I think is valid. Jesus is talking about obedience in this passage but the two ideas are related and not mutually exclusive. Those who behold the Son and believe in Him are the same ones who do what Jesus says (see also John 10:27-28).
22 " 'That day' (v. 22) is the day Jesus will judge false professors. It is almost a technical term for the messianic age (cf. Isa. 2:11, 17; 4:2; 10:20; Jer. 49:22; Zech. 14:6, 20-21)." -Dr. Constable, "Study Notes on Matthew: 2013 Edition," 129.
23 "It is not coincidental that Jesus chose to use the words of David in Psalm 6:8 to express God’s rejection of Israelites after time for entering the door is past. “Depart from Me, all you evildoers” (Luke 13:27). In this psalm, David begins with a petition for God to save him (vss. 1-5). He then described his own suffering, which included (and may have been initiated by) the rejection and resistance of his adversaries (cf. Psalm 6:7b). The last three verses of this psalm (vv. 8-10) conclude the psalm with an expression of confidence that God has heard his petition and will save him. The beginning of this final section is verse 8, and the very words which our Lord spoke. I believe that Jesus is likening His rejection as Israel’s Messiah-King by His people Israel to David’s rejection as Israel’s king by his fellow Israelites. David’s rejection is thus typical of our Lord’s, and David’s words of confidence, spoken to his enemies, can thus be repeated by Israel’s Messiah as well." -Bob Deffinbaugh, "Striving to Enter the Narrow Door," from Bible.org
[Pray] God, help me through your Holy Spirit to understand the Scriptures so I would live well and be able to discern true from false teaching or true from false prophets. Help me to obey what you have commanded me. Would I listen to your Holy Spirit and live in a way that pleases you. In Jesus name, Amen.
[Live] Read the Bible and hold up teachers against the word of God to see if what they are saying is correct. Do the will of God by obeying and living out what God desires for us to do: loving the lowly (poor, orphan, widow, foreigner), seeking justice, telling others about Jesus and salvation, teaching others about God, laying down my life and loving my wife and family the way Christ loves the church, ...