We present a dynamical-chemical model of massive star-forming regions, in which gas and dust grains are included. We consider the last 10(5) yr of the accretion phase of a protostellar object embedded in a dense and massive cloud with a density and temperature gradient. We follow the gas and grain chemical evolution of two collapsing shells of this cloud, until the end of the protostar accretion phase, at which time the density no longer increases. At this point, the temperature rises, the molecular mantles of the grains evaporate, and we follow the time evolution of the resultant gas chemistry. The scenario is based on earlier models of Millar, Brown, Charnley, and Tielens. We find that differences in thermal history during the gravitational collapse of the two circumstellar shells can lead to chemical differentiation between the Orion Hot Core and Compact Ridge, two clumps of OMC-1 very close to the luminous infrared source IRc2. Detailed comparison between our model results and observations of these two sources shows a mixed pattern of agreement and disagreement. The adoption of dynamical histories to achieve good agreement with observation for the abundances of the complex organic molecules leads to some large discrepancies for small species such as NH3.