In this study, an optimal control strategy for the variable refrigerant flow (VRF) system is developed using a data-driven model and on-site data to save the building energy. Three data-based models are developed to improve the on-site applicability. The presented models are used to determine the length of time required to bring each zone from its current temperature to the set point. The existing data are used to evaluate and validated the predictive performance of three data-based models. Experiments are conducted using three outdoor units and eight indoor units on site. The experimental test is performed to validate the performance of proposed optimal control by comparing between conventional and optimal control methods. Then, the ability to save energy wasted for maintaining temperature after temperature reaches the set points is evaluated through the comparison of energy usage. Given these results, 30.5% of energy is saved on average for each outdoor unit and the proposed optimal control strategy makes the zones comfortable.