Cyclin dependent kinase inhibitor 2A (CDKN2A) is an essential regulator of immune cell functionality, but the mechanisms whereby it drives immune infiltration in hepatocellular carcinoma (HCC) remain unclear. In the present study, we studied the association with CDKN2A expression and immune invasion with the risk of developing HCC. A totally of 2207 different genes were found between HCC and adjacent liver tissues from TCGA and GEO databases. CDKN2A was highly expressed in HCC and associated with poorer overall survival and disease-free survival. Notably, CDKN2A expression was positively correlated with infiltrating levels into purity, B cell, CD+8 T cell, CD+4 T cell, macrophage, neutrophil, and dendritic cells in HCC. CDKN2A expression showed strong correlations between diverse immune marker sets in HCC. These findings suggest that CDKN2A expression potentially contributes to regulation of tumor-associated macrophages and can be used as a prognostic biomarker for determining prognosis and immune infiltration in HCC.