I know this is already answered but I feel I should give a couple more reasons. If Ash were to catch a legendary, he would be too powerful in the anime and movies. Catching a legendary probably harms the environment yet there is some proof of that there are multiple trainers who have legendary's and the world seems to continue as normal. in the next couple sentences, I will be talking about Pokemon that have been captured in the anime.
So far here are the legends and the trainers that caught them:
Captured by Red in Pokemon Origins - Mewtwo, Moltres, Articuno, and Zapdos.
Tobias in the Sinnoh series - Latios and Darkrai
Brandon the Pyramid King - Regirock, Registeel, and Regice
Brendan - Latios, and Rayquaza
Nurse Joy - Latias
N - Reshiram or Zekrom
Green - Moltres
There are much more examples that debunk the throwing the world into chaos if you catch them (really good theory! It may or may not be canon in the anime but according to the movies you're not supposed to catch them so you were right to an amount).
Anyway, I hope that this could possibly make the answer better understandable.