This paper presents a model predictive control (MPC) approach to optimize the operation of a transcritical CO2 air source heat pump (ASHP) water heater. Past findings have revealed that the heat rejection pressure is the key factor affecting the system performance of the ASHP. However, the currently used PI controls based on correlations and other control strategies reported in the literature have some limitations. In this paper, we applied the MPC strategy in an ASHP water heater to optimize its operational performance in real-time. Different from the current control strategy aiming to search for the optimal heat rejection pressure, MPC predicts the future operation condition and calculates the optimal inputs based on the control-oriented model and objective function. A high-fidelity physical model is first built in Dymola to produce the operational data, then a data-driven control-oriented model for MPC is derived from the data source via a dynamical system identification. MPC is designed to maximize the coefficient of performance of the ASHP water heater under the state-space equations and constraints. The evaluation is carried out under several cases including fixed ambient temperature, realistic ambient temperature, and variable water outlet temperature. The simulation results prove the control effectiveness of MPC.