Why?
For Cybertron!
It looks like that the Autobots consider Earth their new home, and they don't want to rebuild Cybertron. Decepticons, instead, want to rebuild Cybertron. Sentinel's love for his home planet overcomes his loyalty to his fellows Autobots. He explains it in the movie (even if I acknowledge that dialogues often get lost between Bay's beloved explosions):
Optimus: Why, Sentinel, why?
Sentinel: For Cybertron! For our home! What war destroyed, we can rebuild! But only if we join with the Decepticons.
Optimus: No, it’s not the only way. This is our home! We must defend the humans!
Sentinel: So lost you are, Optimus. On Cybertron, we were gods. And here, they call us machines. Let the humans serve us, or perish.
Autobots consider humans their new friends, which apparently Sentinel can't accept, because he considers them weak. So he probably considers weak also the Autobots, and so he allies with the one he considers stronger: Megatron.
But wait, there's more!
I don't remember if it is explained in the movie (you know, "BOOM > dialogue") but according to the wiki (take the wiki with a grain of salt, as usual!) Sentinel betrayed the Autobots many years ago, when he fled from the dying Cybertron. So he decided to double-cross his allies even before setting foot on Earth, what happened on Earth later (Autobots friends with humans) only made him angrier and his betrayal more vehement.
p.s. Sentinel is not the only one that changed side in the Transformers franchise, so his betrayal is not so "strange".