Here we aimed to explore the change in yak gut microbiota after transferring yaks from grazing grassland to a feedlot, and determine their diet adaptation period. Five yaks were transferred from winter pasture to an indoor feedlot. Fecal samples were obtained from grazing (G) and feedlot feeding yaks at day 1 (D1), day 4 (D4), day 7 (D7), day 11 (D11), and day 16 (D16). The dynamic variation of the bacterial community was analyzed using 16S rRNA gene sequencing. The results showed that the yak gut microbial community structure underwent significant changes after diet transition. At the phylum and genus levels, most bacteria changed within D1–D11; however, no significant changes were observed from D11–D16. Furthermore, we used random forest to determine the key bacteria (at class level) disturbing gut micro-ecology. The relative abundance of the top four classes (Erysipelotrichia, Gammaproteobacteria, Saccharimonadia, and Coriobacteriia) was highest on D1–D4, and then decreased and plateaued over time. Our results demonstrated that an abrupt adjustment to a diet with high nutrition could influence the gut micro-ecology, which was stabilized within 16 days, thus providing insights into diet adaptation in the yak gut.