The boy Moses was hidden for three months because Pharaoh had decreed the murder of Hebrew male borns.
According to the Bible's book of Exodus, the Israelites had become slaves in Egypt and their population was growing. Pharaoh, the king of Egypt, became concerned that the Hebrews were becoming too numerous and might pose a threat to his rule. He ordered that all Hebrew male infants be thrown into the Nile River.
Moses was born to Hebrew parents during this time, and his mother and sister hid him for three months to keep him safe from Pharaoh's decree. When they could no longer keep him hidden, they placed him in a basket and set him afloat on the Nile. He was eventually found by Pharaoh's daughter and raised as a prince in the Egyptian court, until he later fled Egypt and eventually became a prophet and leader of the Israelites.
Therefore, the reason why the boy Moses was hidden for three months was to protect him from Pharaoh's cruel decree, which sought to eliminate Hebrew male infants, and to give him a chance at life.