What made Joseph decide to take his family to Galilee instead of Judea?

God appeared to him in a dream and told him to.

When he heard that Archelaus did reign in Judaea in the room of his father Herod, he was afraid to go thither: notwithstanding, being warned of God in a dream, he turned aside into the parts of Galilee. Matthew 2:22