Hepatocellular carcinoma (HCC) is a highly malignant tumor; however, its immune microenvironment and mechanisms remain elusive. Single-cell sequencing allows for the exploration of immune characteristics within tumor at the cellular level. However, current knowledge regarding the roles of different immune cell populations in liver cancer progression is limited. The main objective of this study is to identify molecular markers with NK cell immune characteristics in hepatocellular carcinoma using various machine learning methods based on Single-Cell Sequencing and Bulk RNA Sequencing. We collected samples from eight normal liver tissues and eight HCC tumor tissues and performed single-cell RNA sequencing for immune cell clustering and expression profile analysis. Using various bioinformatic approaches, we investigated the immune phenotype associated with natural killer (NK) cells expressing high CD7 level. In addition, we verified the role of CD7 in the growth of HCC after NK cell and HCC cells cocultured by RT-qPCR, MTS and Flow cytometer experiments. Finally, we constructed a machine learning model to develop a prognostic prediction system for HCC based on NK cell-related genes. Through single-cell typing, we found that the proportions of hepatocytes and NK cells were significantly elevated in the tumor samples. Moreover, we found that the expression of CD7 was high in HCC and correlated with prognosis. More importantly, Overexpression of CD7 in NK cells significantly inhibited the activity of MHCC97 cells and increased the number of apoptosis of HCC cells (p < 0.05). Furthermore, we observed that NK cells with high CD7 expression were associated with an activated immune phenotype. Our study found that CD7 is an important biomarker for assessing immune status and predicting survival of HCC patients; hence, it is a potential target for immune therapy against HCC.