Much of the 'truth' of Leonard's story at the end comes from Teddy. And here's where so much of the ambiguity about the film as a whole comes from; we don't know whether to believe him. Which is pretty impressive manipulation on the part of Christopher Nolan, because the main reason we distrust Teddy is that throughout the film we have been told to not "believe his lies", something the narrative end shows us is entirely fabricated by Leonard to keep his mission going. Teddy is a cop (he has a badge) and we can chalk up his reluctance to address that directly for most of the film to one of two things; he's undercover as he says to Leonard or he's crooked (given the link to drug dealers and his extreme measure, we're tempted to conclude it's the latter). He is a long-term friend of Lenny's, allegedly the police officer assigned to his case, who in the dearth of police action helped Leonard hunt down the original John G. Subsequently, once it became apparent getting his man had little impact on Leonard's health, he took advantage of him, having him kill various bad people. It's in one of these cases where the black-and-white sequence takes place. Later on, his multiple appearances in the colour segments appear to be with the same goal; ; convince Leonard to leave town lest he becomes recognised as the guy who killed drug dealer Jimmy (as happens with Dodd). That's the most likely version of events. There's a possibility he's the real John G., but that would have to co-exist with him being a cop (there's too much evidence that suggests he was on the force at some point) and requires taking various statements as flat-out lies for the sake of proof. However, the ultimate endorsement that what he's saying is true comes from Leonard himself; at the narrative ending of the film he must believe Teddy's telling the truth as he (once more) adjusts his hunt to target a man he knows isn't his wife's attacker. Deep down he knows it's true.