Gaming app maker Zynga agreed to sell its headquarters building in San Francisco for $600 million to Boston-based real estate investor Beacon Capital Partners, in one of the biggest office sales ever to occur in the nation's most expensive office market.