He can’t stop doing it. Trump claims that he opposed the war, but this is not true. In 2002—before the war started—Howard Stern asked Trump if he supported invading Iraq. Trump said, “Yeah, I guess so.”
Then, in early 2003, he said that the president should focus on the economy more than Iraq. But he did not say that he opposed the war. (It’s worth pointing out that some of the most significant anti-war activism was happening in the spring of 2003.) Then in the spring of 2004—after the war started—he criticized it.
If you’re president, opposing a war after it starts is totally useless. Donald Trump didn’t oppose the Iraq War when it mattered—when, as commander in chief, he could have stopped it. He supported the war. He only opposed it later, after it became fashionable to do so.
Why does Trump keep lying about Iraq? Because he has absolutely no credible claim that he possesses the judgment necessary to be president of the United States. He’s essentially borrowing Barack Obama’s 2008 strategy on Iraq. It worked for Obama because he really did oppose the Iraq War—his claim to having the necessary judgment was credible. Trump’s isn’t.