The sale last week of a downtown Chicago office building is the latest indication that big investors are betting heavily that the Windy City will become an increasingly important technology hub to rival San Francisco and New York.

One South Wacker, a 40-story glass tower built in 1982, sold last week for $344 million to John Hancock Real Estate, a unit of Manulife Real Estate in Toronto. The price represented a significant gain for the seller, private-equity firm Harbor Group International LLC, which paid $221 million for...