Phenotypic plasticity provides an attractive strategy for adapting to various environments, but the evolutionary mechanism of the underlying genetic system is poorly understood. We use a simple gene regulatory network model to explore how a species acquires phenotypic plasticity, particularly focusing on discrete phenotypic plasticity, which has been difficult to explain by quantitative genetic models. Our approach employs a population genetic framework that integrates the developmental process, where each individual undergoes growth to develop its phenotype, which subsequently becomes subject to selection pressures. Our model considers two alternative types of environments, with the gene regulatory network including a sensor gene that turns on and off depending on the type of environment. With this assumption, we demonstrate that the system gradually adapts by acquiring the ability to produce two distinct optimum phenotypes under two types of environments without changing genotype, resulting in phenotypic plasticity. We find that the resulting plasticity is often discrete after a lengthy period of evolution. Our results suggest that gene regulatory networks have a notable capacity to flexibly produce various phenotypes in response to environmental changes. This study also shows that the evolutionary dynamics of phenotype may differ significantly between mechanistic-based developmental models and quantitative genetics models, suggesting the utility of incorporating gene regulatory networks into evolutionary models.