I'm frequently asked: will yoga help me lose weight and/or build muscles? The answer is it depends: how regular is your practice? what kind of yoga (the restorative kind probably won't work for those goals, sorry 😐)? what are your eating habits?
But generally yes, yoga, of course, can do all of that. At least it works for me as I don't do any other physical activity, just yoga, 6 times a week, 2 hours a day. But practiced regularly and with dedication, any sports / physical activity will get you in a better shape. The question is what kind of shape you're trying to get?
I remember once I saw a picture of different athletes, standing in one row. They all looked beautiful, but had extremely diverse body types, just like the picture above. So if you want to look like a swimmer - practice swimming; want to look like a yogi - practice yoga.