The Holy Spirit.
Who exactly decided what that is?
L
The Church. The traditional cannon has been remarkably consistent from the beginning. (I’m not talking whether you do or don’t accept the apocrypha as canonical here.) All of the current books of the NT were widely read and preached from the time they were written in the first century. There was always a general consensus on the traditional cannon with some minor disagreement on two or three books, but not much. The Holy Spirit was guiding the early church from the start in this regard. Just as Jesus and Paul said it would.