You have to be lucky. Every Pokemon has two forms, a regular form and a shiny form. The concept of Shiny Pokemon was introduced in Gold and Silver, so they wanted to show it off with the red Gyarados. A shiny Gyarados is red. The odds of encountering a shiny Pokemon are incredibly low (unless you chain with the Poke Radar, which will only work in grass and therefore cannot be used on Gyarados), so you just have to randomly encounter it.