Solar energy is one of the most promising renewable energy sources that can support the sustainable energy transition. However, the electrical power produced by photovoltaic (PV) panels is greatly influenced by environmental conditions such as irradiation, temperature, humidity, and wind speed, making them volatile and difficult to predict. This study aims to develop a prediction model based on Long Short-Term Memory (LSTM) to estimate the power output of polycrystalline panels. Environmental data is collected in real-time, processed through the normalization stage, and then used as input in several model variants, namely pure LSTM, CNN-LSTM, LSTM-Autoencoder, and GWO-LSTM with metaheuristic optimization. Evaluation was conducted using R², RMSE, and MAPE metrics. The results showed that the pure LSTM model provided good accuracy (R² = 0.95; MAPE = 6.2%), while CNN-LSTM and LSTM-AE improved performance with R² reaching 0.97 and 0.96, respectively. The best model is GWO-LSTM, with R² = 0.98, RMSE = 0.31 kW, and MAPE = 4.3%. These findings prove that metaheuristic optimization in LSTM can increase the reliability of PV power prediction and support a more efficient energy management system.