Numerical simulations of the evolving activity of comet Hale-Bopp are presented. A porous, spherical nucleus, 20 km in radius, made of ice and dust in equal mass fractions, is considered, assuming 5% of CO (by mass) to be occluded in the amorphous ice. The main effects included in the code are the following: crystallization of amorphous ice and release of occluded gas, condensation, sublimation and flow of gases through the pores, changing pore sizes, and flow of dust grains. A sharp rise in the activity of the nucleus occurs at a heliocentric distance of 7 AU preperihelion, marked by an increase in the CO flux and in the rate of dust emission by several orders of magnitude. This is due to runaway crystallization taking place a few meters below the surface, accompanied by the release of the trapped CO. There is a surge in the water vapor production rate as well, but this rate remains 2 orders of magnitude below the CO production rate. The runaway is eventually quenched, and a period of sustained, but variable, activity ensues. The emission of water molecules is found to surpass that of CO at a heliocentric distance of 3 AU. It remains almost constant through perihelion and starts declining beyond 1 AU postperihelion. The model predicts that the comet's activity (and brightness) will not increase dramatically as it approaches perihelion, as might be expected from its unusually high activity at 6-7 AU. It is found that a very porous dust mantle forms between 7 and 2 AU preperihelion, reaching a thickness of about 10 cm. This mantle leads to high surface temperatures. The onset of activity at 7 AU, the large CO flux, and the slowdown in the comet's activity rise as it nears perihelion are in very good agreement with the observations of comet Hale-Bopp.