The purpose of this study is to investigate the efficacy and safety of retatrutide compared with semaglutide in participants with Type 2 Diabetes and inadequate glycemic control with metformin with or without sodium-glucose cotransporter-2 inhibitor (SGLT2i). The study will last about 26 months and may include up to 24 visits.