PURPOSE: Antiretroviral therapy (ART) has resulted in a higher life expectancy of persons living with HIV. This has led to an aging population at risk for both non-AIDS-defining cancers (NADCs) and AIDS-defining cancers (ADCs). HIV testing among patients with cancer in Kenya is not routinely performed, making its prevalence undefined. The aim of our study was to determine the prevalence of HIV and the spectrum of malignancies among HIV-positive and HIV-negative patients with cancer attending a tertiary hospital in Nairobi, Kenya. MATERIALS AND METHODS: We conducted a cross-sectional study between February 2021 and September 2021. Patients with a histologic cancer diagnosis were enrolled. Demographic data and HIV- and cancer-related clinical variables were obtained. HIV pretest counseling and consent were done, and testing was performed using a fourth-generation assay. Positive results were confirmed using a third-generation assay. RESULTS: We enrolled 301 patients with cancer; 67.8% (204 of 301) were female; the mean age was 50.7 ± 12.5 years. From our cohort, 10.6% (95% CI, 7.4 to 14.7, n = 32 of 301) of patients were HIV-positive with the prevalence of a new HIV diagnosis of 0.7% (n = 2 of 301). Of the HIV-positive patients, 59.4% (19 of 32) had a NADC. The commonest NADC was breast cancer (18.8%; 6 of 32), whereas non-Hodgkin lymphoma (18.8%; 6 of 32) and cervical cancer (18.8%; 6 of 32) were the most prevalent ADCs among HIV-positive patients. CONCLUSION: The prevalence of HIV infection among patients with cancer was twice the Kenya national HIV prevalence. NADCs comprised a larger percentage of the cancer burden. Universal opt-out HIV testing of patients attending for cancer care regardless of cancer type may facilitate early recognition of HIV-infected patients and aid in appropriate selection of ART and cancer therapies and preventive strategies.