Intracranial aneurysms (IAs) may cause lethal subarachnoid hemorrhage upon rupture, but the molecular mechanisms are poorly understood. The aims of this study were to analyze the transcriptional profiles to explore the functions and regulatory networks of differentially expressed genes (DEGs) in IA rupture by bioinformatics methods and to identify the underlying mechanisms. In this study, 1,471 DEGs were obtained, of which 619 were upregulated and 852 were downregulated. Gene enrichment analysis showed that the DEGs were mainly enriched in the inflammatory response, immune response, neutrophil chemotaxis, and macrophage differentiation. Related pathways include the regulation of actin cytoskeleton, leukocyte transendothelial migration, nuclear factor κB signaling pathway, Toll-like receptor signaling pathway, tumor necrosis factor signaling pathway, and chemokine signaling pathway. The enrichment analysis of 20 hub genes, subnetworks, and significant enrichment modules of weighted gene coexpression network analysis showed that the inflammatory response and immune response had a causal relationship with the rupture of unruptured IAs (UIAs). Next, the CIBERSORT method was used to analyze immune cell infiltration into ruptured IAs (RIAs) and UIAs. Macrophage infiltration into RIAs increased significantly compared with that into UIAs. The result of principal component analysis revealed that there was a difference between RIAs and UIAs in immune cell infiltration. A 4-gene immune-related risk model for IA rupture (IRMIR), containing CXCR4, CXCL3, CX3CL1, and CXCL16, was established using the glmnet package in R software. The receiver operating characteristic value revealed that the model represented an excellent clinical situation for potential application. Enzyme-linked immunosorbent assay was performed and showed that the concentrations of CXCR4 and CXCL3 in serum from RIA patients were significantly higher than those in serum from UIA patients. Finally, a competing endogenous RNA network was constructed to provide a potential explanation for the mechanism of immune cell infiltration into IAs. Our findings highlighted the importance of immune cell infiltration into RIAs, providing a direction for further research.