In a note to Zynga employees, Mattrick said he is "excited" to join the company.
Pincus, 47, who controls a 61 percent voting stake in the gaming company he founded in 2007, will remain chairman.
Zynga's business model, which relied heavily on selling virtual goods to gamers on Facebook's platform, began to disintegrate a year ago as users tired of Facebook games. Pincus has been unable to turn around the company named after his pet bulldog, Zinga.
The company's shares have hovered at just 25 percent of its $10 price at the company's initial offering price in December 2011.
Mattrick joined Microsoft in 2007 after spending years at Electronic Arts. He helped turn the Xbox business into a profitable venture after years of losses, eventually propelling it into the No.1 selling console in the United States.
Mattrick's departure comes just as Microsoft gears up to launch the third version of its console, called the Xbox One. Unveiled in May and scheduled to hit stores later this year, the machine has already stirred up controversy.
Gamers attacked the high price tag, Microsoft's plan to require an Internet connection at least once a day and moves to limit sharing of used games. Last month, Microsoft reversed its position on the Internet connection and said it would allow game sharing.
Mattrick joins a game maker that publishes social media-based titles and low production-value smartphone games — a departure from the world of big-budget, traditional packaged games embodied by the Xbox.
Mattrick had been rumored to depart for months. After EA's CEO stepped down in March, industry sources have speculated that he was in the running to lead the top games publisher, where he previously held numerous leadership roles.