Molting is one of the most important biological processes of crustacean species, and a number of molecular mechanisms facilitate this complex procedure. However, the understanding of the immune mechanisms underlying crustacean molting cycle remains very limited. This study performed transcriptome sequencing in hemolymph and hepatopancreas of the swimming crab (Portunus trituberculatus) during the four molting stages: post-molt (AB), inter-molt (C), pre-molt (D), and ecdysis (E). The results showed that there were 78,572 unigenes that were obtained in the hemolymph and hepatopancreas of P. trituberculatus. Further analysis showed that 98 DEGs were involved in immunity response of hemolymph and hepatopancreas, and most of the DEGs participated in the process of signal transduction, pattern recognition proteins/receptors, and antioxidative enzymes system. Specifically, the key genes and pathway involved in signal transduction including the GPCR126, beta-integrin, integrin, three genes in mitogen-activated protein kinase (MAPK) signaling cascade (MAPKKK10, MAPKK4, and p38 MAPK), and four genes in Toll pathway (Toll-like receptor, cactus, pelle-like kinase, and NFIL3). For the pattern recognition proteins/receptors, the lowest expression level of 11 genes was found in the E stage, including C-type lectin receptor, C-type lectin domain family 6 member A and SRB3/C in the hemolymph, and hepatopancreatic lectin 4, C-type lectin, SRB, Down syndrome cell adhesion molecule homolog, Down syndrome cell adhesion molecule isoform, and A2M. Moreover, the expression level of copper/zinc superoxide dismutase isoform 4, glutathione peroxidase, glutathione S-transferase, peroxiredoxin, peroxiredoxin 6, and dual oxidase 2 in stage C or stage D significantly higher than that of stage E or stage AB. These results fill in the gap of the continuous transcriptional changes that are evident during the molting cycle of crab and further provided valuable information for elucidating the molecular mechanisms of immune regulation during the molting cycle of crab.