G protein-coupled receptor 119 (GPR119) agonists are being developed to safeguard the function of pancreatic β-cells, especially in the context of non-alcoholic fatty pancreas disease (NAFPD), closely associated with β-cell dysfunction arising from excessive fat accumulation in the pancreas. Drug repurposing technology, abandoning the drawbacks of traditional lengthy, costly, and low-market-probability development methods, has emerged as a new direction in drug development. Here, we employed a drug repurposing technology to screen GPR119 agonists and explore their potential molecular mechanisms for enhancing β-cell function in the context of NAFPD. Employing Schrodinger Suites drug design software, we found that 3622 drugs, including the α-1 adrenergic receptor blocker Terazosin, can bind to GPR119. Terazosin was was further validated to selectively activate GPR119, leading to increased cAMP and ATP synthesis, consequently enhancing insulin secretion. Terazosin administration improved high blood glucose, obesity, and impaired pancreatic β-cell function in NAFPD mice. It inhibited the upregulation of MST1-Foxo3a expression in pancreatic tissue and enhancing damaged mitophagy clearance, restoring autophagic flux, improving mitochondrial quantity and structure in β-cells. Notably, GPR119 deficiency negated the positive impact of Terazosin on pancreatic β-cell function in NAFPD mice, and abolished its inhibitory effect on the MST1-Foxo3a pathway. In conclusions, drug repurposing technology is applicable to the development of GPR119 agonists. Terazosin enhances mitophagy and alleviating β-cell dysfunction in the context of NAFPD by suppressing the MST1-Foxo3a signaling pathway. Terazosin could be considered a priority treatment for patients with concomitant NAFPD and hypertension.