In several tumors, Nicotinamide N-Methyltransferase (NNMT) was identified as a bridge between methylation metabolism and tumorigenesis and was associated with a poor prognosis. This research aims is to study the prognostic value of NNMT in cancer, its relationship with DNA methylation, and the immune microenvironment. On the basis of the Cancer Genome Atlas and the Cancer Cell Line Encyclopedia, Genotype Tissue-Expression, cBioPortal, Cellminer, Gene Expression Profiling Interactive Analysis, Human Protein Atlas and Clinical Proteomic Tumor Analysis Consortium, we used a series of bioinformatics strategies to investigate the potential carcinogenicity of NNMT, including the relationship between NNMT expression and prognosis, tumor mutational burden, microsatellite instability, and sensitivity analysis of anticancer drugs. The GeneMANIA, STRING, and BioGRID databases were examined for protein-protein interactions, and Gene Ontology and the Kyoto Encyclopedia of Genes were used to infer the signal pathway. The results indicated that NNMT was significantly expressed in several tumor tissues compared to the matching non-tumor tissues. Increased NNMT expression was linked to reduced OS, DSS, and DFI. In addition, there was a link between NNMT expression and TMB and MSI in 18 cancer types, and between NNMT expression and DNA methylation in 23 cancer types. Further study of NNMT gene alteration data revealed that deletion was the most prevalent form of NNMT mutation, and that there was a significant negative association between NNMT expression and mismatch repair genes. In addition, there was a strong positive connection between NNMT and immune infiltration in 28 types of tumors, and the immune cells that infiltrated the tumors displayed a characteristic NNMT pattern. According to the enrichment study, cell migration, cell motility, and cell adhesion were highly enriched in biological processes, and NNMT may be associated with the PI3K-Akt signaling pathway. By downregulating gene methylation or impacting the immunological microenvironment widely, NNMT may drive carcinogenesis and cause a poor prognosis. Our research showed that NNMT could be used as a biomarker of tumor immune infiltration and poor prognosis, thus providing a unique strategy for cancer therapy.