During the Prophet’s time there was no official recording or transcripts of Hadiths of what he said.
The Prophet taught by (1) verbally (2) writing it down (3) demonstration
Anas ibn Malik reported: "We sat with the Prophet, maybe sixty persons in number and the Prophet taught them hadith. Later on when he went out for any necessity, we used to memorize it amongst us, when we departed it was as if cultivated in our hearts."
Instead the generation of Muslims who lived with the Prophet (pbuh) sought to preserve his words and deeds either in their memory or through some means of writing.
Amongst the documents that became part of Hadith collections were the official records of the Prophet’s discourses and statements etc.
After the Prophet’s death the Companions assumed both religious and political leadership in the community.
Thus, the study of Hadiths began as a practical attempt to gather, organise and sift through the authoritative statements and behaviour attributed to the Prophet (pbuh).
It was often the junior Companions who became the most prolific collectors and transmitters of Hadiths.
The Prophet’s wives were also a great source of Hadiths.
Companions like Abu Bakr, ‘Umar and ‘Ali did not record large number of Hadiths but rather preserved the teachings in their actions and methods of reasoning rather than by citing them directly.