Why? Because he's indoctrinated of course.
Yeah, that plot twist did wonders for the story and for his character.
TIM is the villain? Nope. He's just a puppet controlled by the Reapers. So the Reapers are the real villains? Nope. They're just puppets being controlled by the Starchild. So the Starchild is the real villain? Nope. He's just some magical god being who kills us with synthetics so we don't get killed by synthetics. So synthetics are the real villains? Nope. Because we can go synthesis on everyone and we can all live happily ever after. Of course, that won't stop synthetics from creating more synthetics that, according to the starchild, will undoubtedly turn on all of us and kill every form of life in the galaxy.
I'm sure this was all covered in book 4.