The Magnetospheric Multiscale (MMS) mission has observed electron whistler waves at the center and at the edges of magnetic holes in the dayside magnetosheath. The magnetic holes are nonlinear mirror structures since their magnitude is anti-correlated with particle density. In this article, we examine the growth mechanisms of these whistler waves and their interaction with the host magnetic hole. In the observations, as magnetic holes develop and get deeper, an electron population gets trapped and develops a temperature anisotropy favorable for whistler waves to be generated. In addition, the decrease in magnetic field magnitude and the increase in density reduces the electron resonance energy, which promotes the electron cyclotron resonance. To investigate this process, we used an expanding box particle-in-cell simulations to produce the mirror instability, which then evolves into magnetic holes. The simulation shows that whistler waves can be generated at the center and edges of magnetic holes, which reproduces the primary features of the MMS observations. The simulation shows that the electron temperature anisotropy develops in the center of the magnetic hole once the mirror instability reaches its nonlinear stage of evolution. The plasma is then unstable to whistler waves at the minimum of the magnetic field structures. In the saturation regime of mirror instability, when magnetic holes are developed, the electron temperature anisotropy appears at the edges of the holes and electron distributions become more isotropic at the magnetic field minimum. At the edges, the expansion of magnetic holes decelerates the electrons which leads to temperature anisotropies.