Green beetle can evolve in to red due to 2 evolutionary processes. 1.Natural selection . 2. Genetic drift.
The green color may have originated from red color due to DNA changes.So new variety has originated due to DNA changes.
If the green has advantage over red color then natural selection will select green over red and in due course of time green beetle numbers will increase as it is more suitable to suroundings.
Another way of evolution can be due to genetic drift.
In this case there is no advatage to green color. Due to an accident or chance most of the red or all of the red beetles died.Due to which only green ones survived .