Excitotoxicity represents the primary cause of neuronal death following spinal cord injury (SCI). While autophagy plays a critical and intricate role in SCI, the specific mechanism underlying the relationship between excitotoxicity and autophagy in SCI has been largely overlooked. In this study, we isolated primary spinal cord neurons from neonatal rats and induced excitotoxic neuronal injury by high concentrations of glutamic acid, mimicking an excitotoxic injury model. Subsequently, we performed transcriptome sequencing. Leveraging machine learning algorithms, including weighted correlation network analysis (WGCNA), random forest analysis (RF), and least absolute shrinkage and selection operator analysis (LASSO), we conducted a comprehensive investigation into key genes associated with spinal cord neuron injury. We also utilized protein-protein interaction network (PPI) analysis to identify pivotal proteins regulating key gene expression and analyzed key genes from public datasets (GSE2599, GSE20907, GSE45006, and GSE174549). Our findings revealed that six genes—Anxa2, S100a10, Ccng1, Timp1, Hspb1, and Lgals3—were significantly upregulated not only in vitro in neurons subjected to excitotoxic injury but also in rats with subacute SCI. Furthermore, Hspb1 and Lgals3 were closely linked to neuronal autophagy induced by excitotoxicity. Our findings contribute to a better understanding of excitotoxicity and autophagy, offering potential targets and a theoretical foundation for SCI diagnosis and treatment.