This is a great example of why sometimes there is no "right" article to use, because either one can work.
Based on a true story = part of this movie really happened.
Based on the true story = part of this movie really happened.
Let's say I produce a movie called Maulik's Adventures on the Stack Exchange. Is that based on a true story, or based on the true story?
Well, there are many true stories, but only one true story that my film is based on, so the works just fine:
the (article) used with a qualifying word or phrase to indicate a particular person, object, etc, as distinct from others ⇒ ask the man standing outside, give me the blue one
That said, we are talking about a particular story – one story, the story of Maulik on the Stack Exchange – so a works, too:
a (article) An adjective, commonly called the indefinite article, and signifying one or any, but less emphatically
Come see Maulik's Adventures on the Stack Exchange, based on a true story
means, "this movie is based on one true story" (but expressed a bit less emphatically).
Come see Maulik's Adventures on the Stack Exchange, based on the true story
means, "this movie is based on the true story of Maulik" (but not the true story of StoneyB, or J.R., or ColleenV).
Your bewilderment stems from an erroneous belief that there exists some litmus test you can use to figure out when you should use one article or the other*. Not so! Macmillan lists 15 possible meanings of the word a, and 14 meanings for the word the. There are some contexts (such as, "Based on _____ true story") where you'll find a meaning for either article that would indicate a valid usage, so either article can be used.
*Usually this "rule" goes something like this: "If you have referenced it previously, use the"