The temporal response of CdZnTe (CZT) detectors is measured under different X-ray flux, spectra, and detector bias conditions. A comprehensive model has been developed to investigate the detector response under these conditions. The calculations have been compared with our measured results. Reasonable qualitative agreement is shown between the model and measurement results. This model provides a powerful tool to understand the detector temporal response, photocurrent dependence on the irradiation intensity, bias voltage, and defect characteristics. Understanding the detector response from a microscopic level can provide a guide to improve material properties and detector device design.