Jesus said this because the people who rejected both him and John were not being wise. Jesus and John the Baptist are the wise ones, and the results of their deeds prove it.
Here “wisdom” is described as a woman who is proven to be right by what she does. Alternate translation: “a person’s wisdom is proved by what he does” or “the results of a wise person’s deeds prove that he is wise”