We evaluated the impacts of lifestyle behaviors, namely smoking, alcohol consumption, and physical activity, on the development of new-onset AF in patients with DM. Using the Korean Nationwide database, we identified subjects diagnosed with type 2 DM and without previous history of AF between 2009 and 2012. Self-reported lifestyle behaviors were analyzed. Among 2,551,036 included subjects, AF was newly diagnosed in 73,988 patients (median follow-up 7.1 years). Both ex-smokers (hazard ratio [HR] 1.05, 95% confidence interval [CI] 1.02–1.07) and current smokers (HR 1.06, 95% CI 1.03–1.08) demonstrated a higher risk of AF than never smokers. Patients with moderate (15–29 g/day) (HR 1.12, 95% CI 1.09–1.15) and heavy (≥ 30 g/day) (HR 1.24, 95% CI 1.21–1.28) alcohol consumption exhibited an increased risk of AF, while subjects with mild alcohol consumption (< 15 g/day) (HR 1.01, 95% CI 0.99–1.03) had an AF risk similar to that of non-drinkers. Patients who engaged in moderate-to-vigorous physical activity showed a lower risk of AF (HR 0.93, 95% CI 0.91–0.94) than those who did not. This study suggests that smoking, alcohol consumption, and physical activity are associated with new-onset AF in patients with DM, and lifestyle management might reduce the risk of AF in this population.