Cardioembolic stroke (CS) is the most common type of ischemic stroke in the clinic, leading to high morbidity and mortality worldwide. Although many studies have been conducted, the molecular mechanism underlying CS has not been fully grasped. This study was aimed at exploring the molecular mechanism of CS using comprehensive bioinformatics analysis and providing new insights into the pathophysiology of CS. We downloaded the public datasets GSE58294 and GSE16561. Differentially expressed genes (DEGs) were screened via the limma package using R software. CIBERSORT was used to estimate the proportions of 22 immune cells based on the gene expression profiling of CS patients. Using weighted gene correlation network analysis (WGCNA) to cluster the genes into different modules and detect relationships between modules and immune cell types, hub genes were identified based on the intersection of the protein-protein interaction (PPI) network analysis and WGCNA, and their clinical significance was then verified using another independent dataset GSE16561. Totally, 319 genes were identified as DEGs and 5413 genes were clustered into nine modules using WGCNA. The blue module, with the highest correlation coefficient, was identified as the key module associated with stroke, neutrophils, and B cells naïve. Based on the PPI analysis and WGCNA, five genes (MCEMP1, CLEC4D, GPR97, TSPAN14, and FPR2) were identified as hub genes. Correlation analysis indicated that hub genes had general association with infiltration-related immune cells. ROC analysis also showed they had potential clinical significance. The results were verified using another dataset, which were consistent with our analysis. Five crucial genes determined using integrative bioinformatics analysis might play significant roles in the pathophysiological mechanism in CS and be potential targets for pharmaceutic therapies.