We model the responses of Tissue-Equivalent Proportional Counters (TEPC) to radiation fields of therapeutic C-12 beams in a water phantom and to quasi-monoenergetic neutrons in a PMMA phantom. Simulations are performed with the Monte Carlo model for Heavy Ion Therapy (MCHIT) based on the Geant4 toolkit. The shapes of the calculated lineal energy spectra agree well with measurements in both cases. The influence of fragmentation reactions on the TEPC response to a narrow pencil-like beam with its width smaller than the TEPC diameter is investigated by Monte Carlo modeling. It is found that total lineal energy spectra are not very sensitive to the choice of the nuclear fragmentation model used. The calculated frequency-mean lineal energy y_f differs from the data on the axis of a therapeutic beam by less than 10% and by 10-20% at other TEPC positions. The validation of MCHIT with neutron beams gives us confidence in estimating the contributions to lineal energy spectra due to secondary neutrons produced in water by C-12 nuclei. As found, the neutron contribution at 10 cm distance from the beam axis amounts to ~ 50% close the entrance to the phantom and decreases to ~ 25% at the depth of the Bragg peak and beyond it. The presented results can help in evaluating biological out-of-field doses in carbon-ion therapy.