If you were surprised when the synthetic at the end of the movie turned out to be the evil, British David and not the kind, bland Walter, then you haven't seen a lot of movies, have you? The minute you see Michael Fassbender playing two robots—one good, one evil—you have to know that the bad one's going to pull the ol' dipsy-doo-switcheroo on our heroes by the end of the movie. It's basically movie law.
However, even if the David reveal was somewhat predictable, it does raise the question: why did David help Daniels and Tennessee during the final showdown with the xenomorph? It's not completely clear, but it seems likely that David suffered from a planet-sized case of hubris—Quoting "Ozymandias" is a dead giveaway. His whole plan seems to center around finding ways to make the xenomorph better through experimentation. We got a glimpse of some of his trials and errors when we saw his lab—along with what remained of Elizabeth Shaw from Prometheus.
It's possible that the final showdown aboard the Covenant was, for David, a test to see whether this version of the xenomorph could get the better of Daniels and Tennessee. It failed, so he's got plans for bigger, badder aliens when the ship finally arrives at Origae-6. On the other hand, maybe he simply saw something in Daniels that he wanted to preserve—again, so he could use her in his future experiments.