Contribution of various components of cosmic rays on an HPGe gamma spectrometer were studied by Geant4. The simulated total spectrum shows good agreement with the measurement background spectrum from 3xA0;MeV up to 50xA0;MeV. Muonic component dominates with 86% of background. Muons secondary particle shower contributes mostly to the spectrum in the energy region of below 3xA0;MeV.