This chapter investigates cyber-physical system (CPS) design for enhancing energy efficiency of heating, ventilation, and air-conditioning (HVAC) systems in a building consisting of multiple zones. We first present a thermodynamics model, called resistance–capacitance circuit model, where the inter-zone heat transfer is identified with current flow on an electrical circuit. We then formulate a set point optimization problem to balance the human comfort and energy saving while satisfying several constraints. We then design a CPS which integrates optimization dynamics based on primal-dual gradient dynamics and the physical dynamics with a local controller. The resulting CPS is then shown to be interpreted as an interconnection of passive systems. Accordingly, convergence of the room temperatures to the optimal solution and input–output stability are rigorously proved based on the passivity paradigm. The present framework is further extended to a scenario of co-optimizing energy management in multiple connected buildings. The present CPS is finally demonstrated on a simulator developed by combining a variety of software.