The Asian elephant (Elephas maximus) is a flagship species of tropical rainforests, and it has generated much concern. In this case, the gut bacterial communities of captive and wild Asian elephants are particularly noteworthy. We aim to compare the differences in bacterial diversity and antibiotic resistance gene (ARG) subtypes in fecal samples of Asian elephants from different habitats, which may affect host health. Analyses reveal that differences in the dominant species of gut bacteria between captive and wild Asian elephants may result in significant differences in ARGs. Network analysis of bacterial communities in captive Asian elephants has identified potentially pathogenic species. Many negative correlations in network analysis suggest that different food sources may lead to differences in bacterial communities and ARGs. Results also indicate that the ARG levels in local captive breeding of Asian elephants are close to those of the wild type. However, we found that local captive elephants carry fewer ARG types than their wild counterparts. This study reveals the profile and relationship between bacterial communities and ARGs in different sources of Asian elephant feces, providing primary data for captive breeding and rescuing wild Asian elephants.