Energy is one of the most important topics for the sustainable development of countries. Due to the fact that the energy used can be depleted, it imports many energy sources, and environmental factors, it is of great importance for Turkey to predict how much energy needs may be in the future. In this study, whale optimization algorithm (BOA) was preferred from heuristic algorithms in order to be able to estimate Turkey's energy demand until 2040. In order to determine the performance of the whale optimization algorithm, the results were compared with the genetic algorithm (GA). All models are arranged linearly and squared and the result is obtained. Data for independent variables such as gross domestic product (GDP), population, imports and exports affecting energy demand were used between 1990 and 2019. Modeling of the past 30 years has been provided to calculate the accuracy of the results. After obtaining the most suitable model, calculations were made according to 4 different scenarios for the next 20 years.