Mycobacterial infections pose significant global health challenges. Recent epidemiological shifts have seen an increase in nontuberculous mycobacteria (NTM) infections, particularly in developed countries, necessitating a comprehensive analysis of mycobacterial isolates over time. This study analyzed the temporal distribution of Mycobacterium tuberculosis complex (MTBC) and NTM isolates from 2016 to 2023, examining factors influencing these trends, including sample types, hospital departments, and drug resistance patterns. A retrospective analysis of 20,569 clinical samples collected at Masih Daneshvari Hospital in Tehran, Iran, was conducted. Samples underwent smear microscopy, culture, molecular identification, and drug susceptibility testing. Statistical analyses included descriptive statistics, chi-square tests, and logistic regression to evaluate trends and associations. NTM detection increased significantly over the study period, with a notable surge in 2022 (OR 3.337, 95% CI: 2.456-4.533, p<0.0001 compared to 2016). Sample type and hospital department significantly influenced mycobacterial species identification (p<0.0001). Respiratory specimens were predominant, with sputum and bronchoalveolar lavage comprising 46.4% and 25.1% of samples, respectively. Smear microscopy results were significantly associated with NTM positivity, with 3+ smears showing lower odds of NTM detection compared to 1+ smears (OR 0.56, 95% CI: 0.42-0.75, p<0.0001). Drug resistance was observed in a considerable proportion of isolates, with isoniazid showing the highest resistance rate (7.8%, 95% CI: 6.9%-8.8%). The study revealed a significant increase in NTM detection over time, highlighting the need for tailored diagnostic and treatment approaches. The persistence of drug-resistant MTBC isolates underscores the ongoing challenges in tuberculosis management. These results demonstrate the importance of continued surveillance and research into mycobacterial infections to inform public health strategies and clinical practices.