Yaakov dies and (for a reason unknown to me) the brothers suddenly suspect Yosef of planning to take advantage of the death and pay them back for how they had treated him many years earlier. Yosef is shocked at the suspicion they have of his intentions and he says to them not to be afrain and I am not in the place of God [to judge and punish you for that]. He then adds, "You planned to do evil to me and Hashem turned it around to good"
My grandfather used to say mensch trocht und gott lacht. Man plans and God laughs. Meaning we all do things and we have hopes and intentions and all sorts of plans how things will work out based on our actions. God's plans do not always coincide with ours (or should that be said differently - our plans do not always coincide with Gods). We forget that God controls the world and we think that if we do x then the result will be y. Hashem can and does change the way things work out for the purpose of His master plan so that the chips will fall into place properly.