So just because a living thing has a certain feature doesn't mean that feature is advantageous. It simply means it doesn't hinder reproduction. Dinosaurs in particular are also difficult to study since we really only have bones to go off of. Animals alive today often look nothing like their bone structure suggests so we might be thinking of dinosaurs all wrong.
From some googling, it seems scientists are guessing as the heads became larger, the arms became smaller. Their giant heads are thought to provide bone crushing jaw strength. Maybe their giant heads used up so much energy that maintaining complex limbs was too much. Another thought is that they ate in packs and limbs would get in the way while pack eating.
The tail plumage of peacocks for example is the opposite of advantageous in everyday life. But since it's sexually selected for (peahens like a showoff with a big tail-fan as a sign of fitness), it's advantageous for reproduction.