Man thinks one thing, makes a plan and goes ahead. He thinks it is good. However, Hashem knows better. The plan fails, and it is for the best. The opposite can also happen.
Man thinks an event or circumstance is bad.
It is not so. Hashem makes something very good come out of it. Yosef himself explains to the brothers how his going down to Egypt was ultimately for the good. Because I sit next to a girl who talks too much. There is a positive side to everything.