I consider myself qualified to answer this question. Since i have practiced both of these.
I have been doing the gym from past 3 years or so. It used to be my daily routine until Dec last year. Starting 2015 i decided that i will try yoga just for a break from gym. ( well the sole motivation towards joining Yoga was, i wanted to work on my mind now, so i was looking for Meditation) and it turned out Yoga is the first basic thing they asked me to do before every session of mediation. Its like a warm up session to heat up your body a little and learn to take the control of your breaths.
Till today i am practicing Meditation day in and day out. After two months of leaving gym i realize i am missing those muscle mass around arms and chest. and practicing Yoga everyday have increased my flexibility and breathing habits.
Now i feel more connected with my body because i can control them better.
On the contrary after two months of gym i used to feel more Fit in terms of strength ( Yes relatively more Fit !) and also more active.
Now coming to your question which is better. I believe depending upon your goals you can choose either of them. If you are a guy who just wanna stay fit and lean by putting minimal efforts. YOGA is your thing.
But if you are a guy who want strength in your arms, a flat belly and a muscular physique, GYM is your home.
Both of them work on your body in different ways and till different extent. But yeah , you wont feel that strong by doing yoga, as compared to gym.
If you ask my advice, i would suggest you to do both . And i can say this because now when do my regular push ups at my home (after learning yoga and mediation) i actually activate my specific body parts more easily as compared to previous years. So let say if i am doing push-ups for my Triceps. Now i close my eyes and with controlled breathing i do my push-ups more effectively by isolating my triceps only (majorly).
So , set your goals what you want from your body and choose accordingly.
Bottom Line –
Yoga – To “know” your body in the best possible way.
Gym – To “grow” your body in the best possible way.