Why was Jesus angry?
This is an interesting passage. There are a number of emotions present here.
Obviously, Mary and Martha are grieving at their loss. Jesus himself also wept at the loss of Lazarus.
But in this verse, Jesus is angry. The greek word used describes situations where there is a stern scolding or warning. So it describes an emotion that, given a serious situation, a warning or scolding is about to be given to those who created the situation.
Who is Jesus angry with? Some versions tell us He was angry in His Spirit or troubled in his Spirit. This gives me a clue.
I think that Jesus was angry at evil. He was about to give a warning to the devil. Jesus seems to be saying, "How dare you take the life of my friend! Soon you are going to take my life, are you so impatient to also take the life of my friend before his time?" In a sense, Jesus was also angry that death had come into creation at all.
Perhaps Jesus was also deeply troubled because it reminded him of His own impending death. It is something He never experienced before. Not only would he experience physical death, but for a moment, He would be forsaken by the Father when He bore the sin of the world. To be stripped of all He possesses and face death alone, not as God, but as man. For that is the only way to really pay for sin. For one end: to save mankind.
But there is one more issue. Since Jesus knew that He was going to raise Lazarus, isn't all this a sham?
I don't think Jesus was just putting up a show. Jesus felt those emotions. It doesn't mean that when you have the power to solve a problem that you don't feel the pain and the evil that caused the problem.
Just like we know christians who die will one day rise, that doesn't mean we don't feel our loss.
So Jesus felt all these emotions. Then He used God's power to raise Lazarus from the dead.