What does Matthew 12:35 mean?
Jesus is condemning the Pharisees for accusing Him of casting out demons by the power of the devil instead of by the power of the Holy Spirit (Matthew 12:24). He is not allowing for the excuse that they just made a mistake or came to the wrong conclusion about Him (Matthew 12:32). They do not have a misunderstanding (John 5:39–40). Jesus is insisting that the Pharisees have spoken evil out of evil hearts. That's how it always works: what's inside one's heart eventually manifests in actions and words (Matthew 12:34).The previous verse ended with that very principle: what's inside overflows and spills out into the world. The Pharisees have revealed their true intentions and state of mind with what they have said.
Now Jesus adds to the idea. Good people generally produce good things out of a good treasure within them. Evil people generally produce evil things from the evil treasure they carry. The heart of a person reveals the nature of a person by what comes out in their words and actions. In building this principle, Jesus is rejecting two possibilities. Good people do not innocently produce evil words or actions; misunderstandings or hard circumstances are not an excuse for evil actions. In the same way, bad people don't accidentally spew good words despite their spiritual darkness. The fruit always reveals the nature of the tree.
To fully grasp that point, it's crucial to realize Jesus is not using the word "good" to mean sinlessness or perfection. Scripture is clear that nobody but Jesus is good in that sense (Romans 3:23). Jesus is talking about the motives, intentions, and focus of the heart, as well as how people respond to Him as the Son of God. When someone speaks or does evil, it's motivated by an evil thought or intent in their heart.