The Holy Spirit, working in and through the apostles, their companions, as well as Christians in apostolic churches, decided what the canon of Scripture would be.
We know from the New Testament that for Jesus of Nazareth, His apostles, and all Palestinian Jews, the canon of the Old Testament was already established. It consisted on just 24 books in the Hebrew Bible, and not one of the apocryphal books was included.
We also know from the 2nd epistle of Peter, that MORE THAN HALF of the New Testament was regarded by God and the apostles as canonical (the epistles of Paul). So by the 2nd century AD, the canon of Scripture was complete and already established, as seen in the Syriac translation of the Bible (the Peshitta).