Nutrition is one of the most influential environmental factors in both taxonomical shifts in gut microbiota as well as in the development of type 2 diabetes mellitus (T2DM). Emerging evidence has shown that the effects of nutrition on both these parameters is not mutually exclusive and that changes in gut microbiota and related metabolites such as short-chain fatty acids (SCFAs) and branched-chain amino acids (BCAAs) may influence systemic inflammation and signaling pathways that contribute to pathophysiological processes associated with T2DM. With this background, our review highlights the effects of macronutrients, carbohydrates, proteins, and lipids, as well as micronutrients, vitamins, and minerals, on T2DM, specifically through their alterations in gut microbiota and the metabolites they produce. Additionally, we describe the influences of common food groups, which incorporate varying combinations of these macronutrients and micronutrients, on both microbiota and metabolic parameters in the context of diabetes mellitus. Overall, nutrition is one of the first line modifiable therapies in the management of T2DM and a better understanding of the mechanisms by which gut microbiota influence its pathophysiology provides opportunities for optimizing dietary interventions.