I’m guessing that God must have impressed him with the importance and significance of the dreams to the point that he couldn’t keep them to himself and also so he could fulfill Gods plan for his life. I can’t imagine why else he would keep telling his brothers when it made them hate him more and more.
Joseph had already been a shepherd, learned to fight off wolves and matured at a young age. When he told his brothers the dreams, he told them as a dream not to make them jealous or mad at him. God knew what his brothers would do to Joseph that would cause them to sale Joseph into slavery. So he could save Family from starving. Oh to be like Joseph and trust in the Lord! To not be angry in the circumstances we are in.