The Martian film is based on a novel of the same title by Andy Weir. After publishing his book, Weir was confronted by many disputing his science. Although touted as a "love story to science," Weir acknowledges scientific inaccuracies.
Weir participated in an author interview (via Skype) at the 2015 Atlanta Maker Faire. After a discussion on his remarkable success with the book after he self-published and posted it on Amazon, Weir fielded questions from the audience. When the subject of scientific inaccuracies came up, he addressed whether or not realizing he'd made mistakes bothered him.
Weir explained that publishing science fiction in the age of virtually effortless access to information leaves authors and their stories vulnerable to scrutiny by very intelligent members of the scientific community. While some authors may be embarrassed or irritated by their errors being pointed out, Weir insists he finds joy in it. Although he is very interested and knowledgeable about Mars and all the relevant science of traveling there and being subsequently stranded there, Weir is a computer programer by trade.
He explained that years of being a computer nerd and not having a social life or a girlfriend allowed him to dedicate the time away from his full time job to writing, which was a passion of his. His research on The Martian was done almost wholly via Google. Although many of the calculations in the book are impressively realistic, Weir knew he did not have all the information needed to make such calculations applicable to actual reality.
But the book he was writing was fiction, and Weir took license with that.
In 1996, the Coen brothers released Fargo. At the beginning of the film, there is a statement proclaiming it to be based on a true story. The film was not, in fact, based on a true story, and the end of the film included the usual disclaimer about it all being fiction. Many people, though, including myself, believed it to be a true story.
Why? Because it was a really good movie, brilliantly written and directed, and it was believable.
So is The Martian based on a true story? Of course not. I already went over this: it is science fiction. However, it is a really good movie, brilliantly written and directed, and apparently to those who don't know any better, it is believable.
For the record, at the time of this publication, Andy Weir does have a human girlfriend.
Fun Fact: when asked how we could produce great scientists like Mark Whatney, Weir said to take a bunch of children and strand them on Mars: "the strong will survive."