To catch legendary Pokemons, you need to keep them busy by giving them berries. While they are occupied, adjust your Pokeball and catch them.