That is a very long story. The canon of the Tanakh (Old Testament), which was written over a period spanning from the 13th century BC to around the 5th century BC, was settled long before the New Testament was written. The books that were accepted into the New Testament were written sometime between 45 and 95 AD according to conservative estimates, or between 65 and 150 AD according to liberal estimates.
Over the centuries leading up to the Councils of Hippo and Carthage (which is when the New Testament canon was officially settled; not, as some believe, at the Council of Nicea), many early Christians had lists of books they considered to be canon. None of the books they accepted were rejected, but some that they considered dubious were accepted.
Constantine did have a hand in the events leading up to the official canon, but he did not preside over the actual councils. He was actually long dead by that time.
A good place to start for the development of the New Testament canon:
http://en.wikipedia.org/wiki/Development_of_the_New_Testament_canon
and Old Testament:
http://en.wikipedia.org/wiki/Development_of_the_Old_Testament_canon
I've read many early Christian writings, and I think these articles are fairly close to the truth.
BTW, there was no gospel of David. There is a "gospel" of "Barnabas" which survives in a 16th century manuscript written in Italian. Some claim it's based off of an earlier gospel of Barnabas, but there's no proof of that. It's this gospel of Barnabas that claims Jesus wasn't crucified.
Edit: Oh, and the canon was *not*, I repeat NOT, settled at the Council of Nicea. The canon wasn't even discussed there.
The agenda of the Nicene council was:
The Arian question regarding the relationship between God the Father and Jesus; i.e. are the Father and Son one in divine purpose only or also one in being;
The date of celebration of the Paschal/Easter observation
The Meletian schism;
The validity of baptism by heretics;
The status of the lapsed in the persecution under Licinius.
http://en.wikipedia.org/wiki/First_Council_of_Nicaea#Agenda_and_procedure