The Autobiography of Malcolm X
was actually written by Alex Haley
, from interviews with Malcolm conducted over many years.
Haley first interviewed Malcolm X for an article in Playboy Magazine, and later, at the urging of his publisher, asked him if he would tell his life story for publication. After receiving the permission of Elijah Muhammad, his spiritual leader, and imposing the condition that all money raised from the sale of the book would go to the Nation of Islam*, Malcolm agreed. Haley compiled the book from years of notes, interviews and conversations, and it was published shortly after Malcolm X's death in 1965.
If you want to read more about the contents of the book, see the excellent writeup by SheThing at Malcolm X.
* The proceeds didn't go to NOI, by the way. They go to Malcolm X's family. The book was published with joint copyright going to Betty Shabazz
and Alex Haley