Background: Cancer of unknown primary (CUP) is a challenging malignancy characterized by metastatic tumors with an unidentified primary site, even after extensive pathological and radiographic evaluation. Recent advancements in gene expression profiling and comprehensive genomic profiling (CGP) using next-generation sequencing (NGS) have enabled the identification of potential tissue origins, thereby facilitating personalized treatment strategies. Although most cases of CUP present as adenocarcinomas or poorly differentiated tumors, the treatment remains largely empirical, with limited success from molecular tailored therapies. However, advances in tumor DNA sequencing and targeted therapies hold great promise for enhancing patient outcomes. Case: A 72-year-old woman presented with epigastric pain and was diagnosed with a duodenal tumor and gastric ulceration via esophagogastroduodenoscopy. A histological evaluation revealed poorly differentiated adenocarcinoma in the duodenum, and the immunohistochemistry findings supported a pancreatobiliary origin. An endoscopic ultrasound-guided biopsy confirmed poorly differentiated adenocarcinoma in the duodenum, while a subsequent gastric examination revealed well-differentiated adenocarcinoma, suggesting dual malignancies. The patient underwent neoadjuvant chemotherapy, followed by pancreatoduodenectomy with distal gastrectomy. The CUP was staged as poorly differentiated adenocarcinoma (pStage IVB), while the gastric cancer as well-differentiated adenocarcinoma (pStage IA). Despite adjuvant TS-1 therapy, lymph node metastasis near the superior mesenteric artery continued to progress. CGP revealed high microsatellite instability and a high tumor mutational burden, along with multiple actionable genetic mutations. Pembrolizumab monotherapy was initiated, leading to complete remission, with no recurrence observed at one year after treatment cessation. Genetic and immunohistochemical investigations have identified microsatellite instability in both CUP and gastric cancer tissues, suggesting a shared origin. Targeted gene sequencing confirmed common genetic variations, ultimately revealing that the CUP originated from gastric cancer cells. Conclusion: This case highlights the critical role of CGP in the diagnosis and treatment of CUP. The use of advanced molecular techniques, including NGS, revealed the gastric origin of CUP and identified actionable biomarkers, leading to successful treatment with immune checkpoint inhibitors.