Personally I think it's a combination of both.
K so first off, you do notice alot of the megas were from Gen I, the original games - Kangaskhan, the starting trio, Mewtwo etc.
My personal gut feeling on this, is they chose many of these Pokemon for the retail value. The starters Blastoise, Charizard and Venusaur were still immensely popular, and would probably bring retail value, by 'reintroducing' them into the game, except in a different fashion - the same applies for other Megas who seemed popular like Lucario. MOAR MONEY.
According to this site;
>When asked where the idea for Mega Evolution came from, Masuda replied: “Both of us have lived in Japan, so seeing all those [Japanese] superheroes probably influenced us a little bit! Mega Evolution is a new type of Evolution, rather than a power-up. In terms of deciding which Pokémon would be able to Mega Evolve, such as the three starters, we focused on those Pokémon that were fan favourites,”.
Key word. Fan Favourites.
Ie. More popularity. More sales. More spin offs. More random plushies and stuff. More money. More profit. More happy Nintendo!
Now as for why I think it's a combination of both randomness and profit margins. I don't get megas like Mawile and Manetric. Sure they're great and all, but I think that there were probably more popular Pokemon out there.
Also according to the same site Masuda said;
>We had to think about which Pokémon we should Mega Evolve to balance the battles better: doing certain ones might have ruined that balance
YEAH LIKE WE NEEDED A MEGA EVOLUTION FOR MEWTWO.