Time series forecasting is crucial across various sectors, aiding stakeholders in making informed decisions, planning for the short and long term, managing risks, optimizing profits, and ensuring safety. One significant application of time series forecasting is predicting Earth surface temperatures, which is vital for civil and environmental sectors such as agriculture, energy, and meteorology. This study proposes a hybrid forecasting model for Earth surface temperature using Deep Learning (DL). To improve the DL model's performance, an optimization algorithm called Barnacles Mating Optimizer (BMO) is integrated to optimize both weights and biases. The forecasting model is trained on a global temperature dataset with seven inputs and compared with DL models optimized by Particle Swarm Optimization (PSO), Harmony Search Algorithm (HSA), and Ant Colony Optimization (ACO). Additionally, a comparison is made with the Autoregressive Moving Average (ARIMA) method. Evaluation using Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and the coefficient of determination (R2) demonstrates the superior performance of DL optimized by BMO, showing minimal errors.