According to Wikipedia, screenwriter Charlie Kaufman always had Malkovich in mind due to his acting style and the sound of his name. Later, Malkovich took an interest in producing the film, but it took years until he was convinced to play himself in it.