Gen 50:20 As for you, you meant evil against me, but God meant it for good, to bring it about that many people should be kept alive, as they are today.
This passage is used to claim God is responsible for all that happened to Joseph. Neil Short writes:
These passages seem to clearly teach that God orchestrated the sin of Joseph’s brothers in order to bring about a greater good. The plain sense of a passage is not always the correct sense. Consider evangelist Stephen’s explanation in his swan-song sermon in Acts.
9 “The patriarchs, jealous of Joseph, sold him into Egypt; but God was with him, 10 and rescued him from all his afflictions, and enabled him to win favor and to show wisdom when he stood before Pharaoh, king of Egypt, who appointed him ruler over Egypt and over all his household.
According to Stephen, God’s action began after the sin of Joseph’s brothers. God worked through various people to bring Joseph into a better situation in which the work of God would be evident. He granted that Joseph would have favor in the eyes of his master Potiphar (Genesis 39:4, which did not work out all that well), his jailer (Genesis 39:21) and Pharaoh (Genesis 41:44, Acts 7:10).
Thus, God did indeed mean it for good but only after the fact of the brothers’ sin. God did not need the sin of these brothers to accomplish his plan. God took a negative intention and worked out a positive result.
This interpretation was understood by Stephen in Acts.