Because James did save Snape’s life.
Dumbledore isn’t lying; there’s an incident described at the end of the third book in which Snape’s life really was saved by James:
“Severus was very interested in where I went every month.” Lupin told Harry, Ron, and Hermione. “We were in the same year, you know, and we — er — didn’t like each other very much. He especially disliked James. Jealous, I think, of James’s talent on the Quidditch field… anyway Snape had seen me crossing the grounds with Madam Pomfrey one evening as she led me toward the Whomping Willow to transform. Sirius thought it would be — er — amusing, to tell Snape all he had to do was prod the knot on the tree trunk with a long stick, and he’d be able to get in after me. Well, of course, Snape tried it — if he’d got as far as this house, he’d have met a fully grown werewolf — but your father, who’d heard what Sirius had done, went after Snape and pulled him back, at great risk to his life…. Snape glimpsed me, though, at the end of the tunnel. He was forbidden by Dumbledore to tell anybody, but from that time on he knew what I was…”
— Prisoner of Azkaban, chapter 18 (Moony, Wormtail, Padfoot, and Prongs)
And this is the passage you’re referring to when Harry is in the hospital wing, recovering from his encounter with Quirrell:
“Quirrell said [Snape] hates me because he hated my father. Is that true?”
“Well, they did rather detest each other. Not unlike yourself and Mr Malfoy. And then, your father did something Snape could never forgive.”
“What?”
“He saved his life.”
“What?”
“Yes…” said Dumbledore dreamily. “Funny, the way people’s minds work, isn’t it? Professor Snape couldn’t bear being in your father’s debt… I do believe he worked so hard to protect you this year because he felt that would make him and your father quits. Then he could go back to hating your father’s memory in peace…”
Harry tried to understand this but it made his head pound, so he stopped.
— Philosopher's Stone, chapter 17 (The Man with Two Faces)
While Snape may have had other motivations for helping Harry (such as his promise to Dumbledore, or his love for Lily), there’s nothing to say that he didn’t also want to settle his debt with James. So it’s fine for Dumbledore to say this, even if it somewhat confuses Harry.