Pineapple is a globally significant tropical fruit, but its cultivation faces numerous challenges due to abiotic and biotic stresses, affecting its quality and quantity. WRKY transcription factors are known regulators of stress responses, however, their specific functions in pineapple are not fully understood. This study investigates the role of AcWRKY31 by overexpressing it in pineapple and Arabidopsis. Transgenic pineapple lines were obtained using Agrobacterium-mediated transformation methods and abiotic and biotic stress treatments. Transgenic AcWRKY31-OE pineapple plants showed an increased sensitivity to salt and drought stress and an increased resistance to biotic stress from pineapple mealybugs compared to that of WT plants. Similar experiments in AcWRKY31-OE, AtWRKY53-OE, and the Arabidopsis Atwrky53 mutant were performed and consistently confirmed these findings. A comparative transcriptomic analysis revealed 5357 upregulated genes in AcWRKY31-OE pineapple, with 30 genes related to disease and pathogen response. Notably, 18 of these genes contained a W-box sequence in their promoter region. A KEGG analysis of RNA-Seq data showed that upregulated DEG genes are mostly involved in translation, protein kinases, peptidases and inhibitors, membrane trafficking, folding, sorting, and degradation, while the downregulated genes are involved in metabolism, protein families, signaling, and cellular processes. RT-qPCR assays of selected genes confirmed the transcriptomic results. In summary, the AcWRKY31 gene is promising for the improvement of stress responses in pineapple, and it could be a valuable tool for plant breeders to develop stress-tolerant crops in the future.