Many things are taught by poetry. That is how we can learn concepts that are big and rich because we can think of it in a way that is similar to a concept we already understand.
Matthew 7:18
A good tree can’t produce bad fruit, and a bad tree can’t produce good fruit. (NLT).
Jesus says that there is a type of tree that produces good fruit, and there is also a type of tree that produces bad fruit. He is not saying this to tell people about horticulture, He is using this poetic illustration to teach a spiritual concept about why some people are naturally inclined to produce good while others are more inclined to produce evil.
He is using a common concept in Christian thought: "fruit" describes our behaviours/decisions/actions/speech. Fruit is a thing that results from the growth of a tree, so we can think of the purpose of the tree like this: the tree is the living, growing thing whose whole life and effort is dedicated for the production of fruit. If you know anything about fruit trees, you will know that some trees have a natural resilience against disease. Some trees produce fruit that lasts a long time and looks clean/perfect. Those are the types that have been selected for commercial production in the present age. There is also a right way and a wrong way to treat a tree. The way a tree is fed, positioned, watered and pruned - all those things can have a big impact on the quality of the fruit. For example, if a tree is cut to produce lots of vigorous upright growth, it will not produce much fruit and it will become very woody. Likewise, if a tree is allowed to grow laden, it loses the vigour and becomes prone to disease. Once a tree has been damaged, it can sometimes be impossible to restore it to the full potential of health again.
So when you think about how our words and our attitudes can be described as fruit, then you understand this: whatever is behind our words, attitudes and decisions - it comes from the life we have had: the experiences of life and the people that have been around us and have influenced us, that is what shapes us to think and to believe that the world is what we think it is and that we are who we think we are. It is our beliefs about ourselves and the world that basically produces our behaviours.
So Jesus is saying here "If you make a tree good" (that means to bring a person into a good way of thinking - looking at the world and at themselves in a certain way) then their "fruits" (behaviours etc) will be good. But if you cause a person to have a bad view of the world or of themselves, then their behaviours will be rotten.
He is saying this to His students, warning them that there are many false teachers and "wolves who wear sheep's clothing - outwardly appearing harmless but inwardly they are seeking to devour you". He says it so that we might be encouraged to be firm when those false teachers appear to have more status than us because he says in verse 21 that those types will come to Him and will seek His approval for the things they had done in His name, but He will dismiss them, saying that they are lawless and "workers of iniquity".