In recent years, the gene regulatory circuit in biological systems has attracted a considerable interest. In this paper, we consider the dynamical behaviors of the gene regulatory circuit in Bacillus subtilis, including deterministic system and stochastic system effected by colored noise. First of all, the global dynamical behaviors of the deterministic system are exhibited by numerical method. Moreover, we give an effective method to explore the stochastic response and bifurcation by means of the stochastic generalized cell mapping method. To satisfy the Markov nature, we transform the colored-noise system into the equivalent white-noise system. And the stochastic generalized cell mapping method can be used to obtain the dynamical behaviors of the stochastic system. We found that the system parameters and noise can induce the occurrence of the stochastic P-bifurcation in the stochastic system, which means that the conversion between competent state and vegetative state in Bacillus subtilis is possible. In addition, the effectiveness of the stochastic generalized cell mapping method is verified by Monte Carlo simulation.