Melatonin (MT) is crucial in plant growth, development, and response to stress. Celery is a vegetable that grows in a cool climate, and a hot climate can deteriorate its growth, yield, and quality. This study investigates the effect of exogenous melatonin on celery physiology. Transcriptional levels were analyzed by spraying celery with exogenous MT before exposing it to high temperatures. The regulatory mechanism of exogenous MT-mediated heat tolerance was examined. The results show that the exogenous MT reduced the thermal damage state of celery seedlings, as well as the malondialdehyde (MDA) content and relative conductivity (REC), increasing the oxidase activity, the osmotic regulatory substances, and chlorophyll, enhancing the leaf transpiration and the light energy utilization efficiency. We examined the mechanism of exogenous MT in mitigating high-temperature damage using the transcriptome sequencing method. A total of 134 genes were expressed differently at high temperature in the celery treated with MT compared with the untreated celery. Functional annotation analysis revealed that the differentially expressed genes were abundant in the “pyruvate metabolism” pathway and the “peroxidase activity” pathway. According to the pathway-based gene expression analysis, exogenous MT can inhibit the upregulation of pyruvate synthesis genes and the downregulation of pyruvate consumption genes, preventing the accumulated pyruvate from rapidly upregulating the expression of peroxidase genes, and thereby enhancing peroxidase activity. RT-qPCR verification showed a rising encoding peroxidase gene expression under MT treatment. The gene expression pattern involved in pyruvate anabolism and metabolism agreed with the abundant transcriptome expression, validating the physiological index results. These results indicate that the application of exogenous MT to celery significantly enhances the ability of plant to remove reactive oxygen species (ROS) in response to heat stress, thereby improving the ability of plant to resist heat stress. The results of this study provide a theoretical basis for the use of MT to alleviate the damage caused by heat stress in plant growth and development.