Gallium nitride (GaN) semiconductor material can become semi-insulating when doping with carbon. Semi-insulating buffer layers are utilized to prevent leakage currents in GaN high power devices. Carbon is inherently present during chemical vapor deposition (CVD) of GaN from the use of trimethyl gallium (TMGa) as precursor. TMGa decomposes in the gas phase, releasing its methyl groups, which could act as carbon source for doping. It is previously known that the carbon doping levels can be controlled by tuning the CVD process parameters, such as temperature, pressure and precursor flow rates. However, the mechanism for carbon incorporation from TMGa is not yet understood. In this paper, a model for predicting carbon incorporation from TMGa in GaN layers grown by CVD is proposed. The model is based on ab initio quantum chemical calculations of molecular adsorption and reaction energies. Using Computational Fluid Dynamics, with a chemical kinetic model for decomposition of the precursors and reactions in the gas phase, to calculate gas phase compositions at realistic process conditions, together with the proposed model, we obtain good correlations with measurements, for both carbon doping concentrations and growth rates, when varying the inlet NH3/TMGa ratio. When varying temperature (800 – 1050°C), the model overpredicts carbon doping concentrations at the lower temperatures, but predicts growth rates well, and the agreement with measured carbon doping concentrations is good above 1000°C.