Because of his promise to Caleb and because he genuinely cared for the family.
I don't think David lied with all the talk about Caleb being his friend and he swearing to him to visit his family (he was on the photo afterall). Maybe he wanted to always stay for longer or maybe he really only wanted to stay for short. In fact the phone call he did might really have been the surgeon he wanted to visit right after checking by Caleb's family shortly, trying to start a new life just after that. But the family was more than happy to have him stay, having found somewhat of a replacement son in him.
And he wanted to genuinely help the Petersons, on the one hand because he felt responsible to take care of his late comrade's family, and on the other hand maybe because he seemed to grow more and more attached to them. But well, David being the quite deranged person he is, his means of helping the family were rather extreme, but they were always supposedly in their best interests, I think, from beating up Luke's bullies, getting Spencer's boss out of the way for Spencer's promotion and freeing Anna from her lazy-ass and unhealthy boyfriend (and he had to murder the gun sellers because they could implicate him easily, I guess). According to David (and he has no reason to lie to Mrs. Peterson right before killing her):
I wanted to help. I considered it my mission to assist you all while I was here. There were just too many complications.
He wasn't so paranoid about his identity until it started to crumble. Afterall, the Petersons didn't have much reason to blow his identity, for all they knew he was a former comrade of Caleb, and I guess that much was pretty true. It was only once he realized that his cover had been blown that he started to kill everyone, including the Petersons, since that was part of his mental programming, as Major Carver explains it:
David has neurological conditioning Miss Peterson, designed to protect both him and the experiment. If he feels like his identity may be compromised, he's programmed to clean up all loose ends. I doubt he could stop himself now even if he wanted to.
And even though he ultimately can't fight his own nature, we can see a bit of remorse in him when he apologizes to Laura and Spencer for killing them and when he tries to comfort Luke after he stabbed David, saying
You did the right thing, I don't blame you. Don't feel bad.