In Matthew 21 we find that Jesus was hungry and saw a fig tree by the side of the road. It may appear that Jesus is just responding in anger to the tree, cursing it in tantrum-like behavior. But this is not the case at all. One must keep in mind the broader backdrop of Jesus' teaching methodology, which often involved parables and word pictures.
Scholars have different opinions.
Some say Jesus was illustrating the principle of faith to the disciples. They would need such faith in the hard days to come. But upon closer examination it became clear that there was no fruit on it at all. Still other scholars suggest the fig tree is representative of faithless Israel. Israel professed to be faithful to God and fruitful as a nation, but in fact it was faithless and fruitless.