But it was nonetheless based on a screenplay. And just because both came out in 1968 does not mean they came out at the same time. The book came out after the movie.
https://en.wikipedia.org/wiki/2001:_A_Space_Odyssey_%28film%29