Reducing electricity peak demand is essential to maintain the balance between supply and demand side in electricity power markets, as well as reduce utility costs and environmental impacts. With growth in adoption of Electric Vehicles (EVs), there is an emerging opportunity to balance electrical power demand of buildings by storing electricity in EVs during low demand periods and discharging electricity into buildings during peak demand periods. Due to uncertainty in time and magnitude of peak demand, decision makers are always faced with a challenging task to identify optimal schedules for charging and discharging EVs to minimize peak electricity demand. This paper presents the development of a novel system that is capable of predicting day-ahead building electricity demand profile and identifying optimum schedule of charging and discharging EVs to minimize electricity peak demand. The system is designed to comply with planned EV trip schedules and minimum state of charge (SOC). The system consists of (1) machine Learning (ML) model to predict electrical power demand, and (2) demand management optimization model to identify optimal schedule for charging and discharging EVs. Four methods are explored to develop the ML model, including histogram-based gradient boosting, random forest, deep artificial neural network (DNN), and long short-term memory (LSTM). A case study of multi-tenant commercial building is analyzed to evaluate the performance of the system and demonstrate its new capabilities. The results of the case study shows that LSTM has the best performance in terms of mean absolute error, root mean square error, and mean absolute percentage error with average values of 7.44, 17.78, and 20.08 %, respectively. Five scenarios for shaving peak electricity demand, including combinations of two electric vehicles, a stationary battery, and a PV system are investigated. Scenarios including the stationary battery and the PV system are considered to evaluate the full potential of peak demand reduction in the case study building. The results of the demand management optimization model show up to 36 % reduction in peak demand using two EVs, one stationary battery, and PV system of 40 kW capacity. The key contributions that this study adds to existing knowledge are: (1) developing machine learning models to predict day-ahead electricity demand in 15-minute intervals, (2) integrating machine learning and optimization algorithms in identifying EV charging and discharging schedules to minimize utility cost by shaving peak energy demand, and (3) considering planned EV trips and minimum SOC requirements in identifying optimal charging and discharging of EVS to shave peak energy demand in buildings. The implementation of this system provides practical solutions for managing electricity demand in commercial buildings using EVs. By reducing energy consumption and promoting the innovative use of EVs, this system offers a sustainable approach to managing electricity demand in commercial buildings.