Buildings account for a large percentage of the energy consumption in the United States. A significant portion of this energy is used to achieve thermal comfort in buildings. Recent studies showed that occupant behavior is one of the most influential factors that affect building energy consumption. A significant amount of energy, therefore, can be saved through improving the behavior of occupants. Although a large body of studies have been conducted to better understand and improve occupant behavior, there is still a lack of research attention to identifying the occupant behavior that would achieve both reduction in energy consumption and improvement in occupant comfort. To address this need, this paper presents a machine-learning-based approach (1) to model the impact of occupant behavior on building cooling energy consumption, and (2) optimize a set of occupant-behavior-related variables for reduced cooling energy consumption while maintaining occupant thermal comfort. The research methodology included three primary phases. First, a set of buildings were modelled and simulated in EnergyPlus, with different values for occupant-behavior-related variables. Second, learning from the simulation-generated data, support vector machine (SVM)-based occupant-behavior-sensitive models for predicting hourly building cooling energy consumption, operative temperature, and relative humidity were developed. Third, using genetic algorithm, a preliminary hourly occupant-behavior optimization was conducted to determine the optimal values for occupant-behavior-related variables for achieving minimum hourly cooling energy consumption levels while maintaining occupant thermal comfort. The results showed that the proposed machine-learning-based approach can be successful in optimizing occupant behavior.