In Matthew chapter 1, we read about Joseph, and how he experienced deep disappointment. He was engaged to be married and found out his fiance was pregnant. He was a righteous man and while deeply disappointed and discouraged, made the decision to quietly break off his engagement with Mary. In verse 21 we pick up the story..."as he considered this, an angel of the Lord appeared to him in a dream. Joseph, son of David, the angel said, do not be afraid to take Mary as your wife. For the child within her was conceived by the Holy Spirit. And she will have a son, and you are to name him Jesus, for he will save his people from their sins."
Joseph's plan was thrown into chaos because of circumstances he could not understand. But God's plan was perfect, and Joseph was given the privilege of naming the Savior of the World!