Berberine hydrochloride is the main active ingredient of Coptis chinensis, which has demonstrated significant antibacterial activity against bacteria. However, the molecular mechanism underlying its effects is unclear in crabs. In this study, we used transcriptome sequencing to investigate the molecules involved in the therapeutic and defensive responses of Charybdis japonica infected with 105 colony-forming units (CFU)/L of Aeromonas hydrophila following treatment with berberine hydrochloride. A total of 5,409 differentially expressed genes were observed after exposure of C. japonicus for 72 h to 100 mg/L berberine hydrochloride, 100 mg/L berberine hydrochloride plus injection of 105 CFU/L A. hydrophila, and a control group injected with equal amount of physiological saline solution. Enrichment analysis revealed that these genes were involved in metabolism, cellular processes, signal transduction, and immune function. The transcriptomic results indicated that exposure to berberine hydrochloride activated glutathione metabolism, oxidative phosphorylation, fatty acid degradation, retinol metabolism, pyruvate metabolism, and the hypoxia-inducible factor 1 signaling pathway. Transcriptomic analysis and relative mRNA level analysis also identified acid hydrolase genes and phagosomal genes as key factors regulating the adaptation of acid berberine-infused C. japonicus to infection with A. hydrophila, Based on the ability of berberine hydrochloride to induce acid hydrolase and phagosomal gene expression, which can in turn remove bacteria, immersion in berberine hydrochloride may remove A. hydrophila and thus improve the survival of C. japonica. The results of this study provided a new scientific basis for the potential role of berberine hydrochloride in the immune mechanisms of crabs.