Query Regarding Surah Kahf
God, in the very first place, has the right not to give any chance to anyone, but He chose to provide a chance for some and not to others, like the children who die before they attain adulthood. The child in the story of Moses and the man of God (who was most probably an angel who executed the commands of God) was innocent and will not go to hell, and most probably will go to Jannah, as God is not only just but also generous.