Investigating the repercussions of climate change and irrigation timing on groundwater contamination necessitates thorough examination of the fluctuations in seawater and groundwater recharge temperature. This study introduces an innovative numerical approach to analyze groundwater salinity and temperature dynamics across three distinct scenarios using the SEAWAT code based on Henry's problem. The first scenario delves into the impact of seawater temperature, the second focuses on the consequences of aquifer freshwater recharge temperature, and the third amalgamates the effects of both scenarios. Remarkably, the study reveals that saltwater intrusion (SWI) experiences a decline attributable to the aquifer's heightened seawater temperature and the diminished inland freshwater temperature. Furthermore, combining these two scenarios has a more pronounced effect on aquifer pollution; the temperature-induced changes in SWI for this third scanrio reach + 8.10%, + 12.70%, + 16.20%, + 24.90%, + 28.30%, and + 31.80% compared to the case without considering the temperature effect. Notably, our results propose a potential strategy to mitigate SWI by introducing cold freshwater recharge into aquifers, such as irrigation at night time when water temperature is low. This innovative approach underscores the interconnectedness of various environmental factors. It provides a practical avenue for proactive intervention in safeguarding groundwater quality against the adverse impacts of climate change and irrigation practices.