  We describe the Monte Carlo (MC) simulation package of the Borexino detector
and discuss the agreement of its output with data. The Borexino MC 'ab initio'
simulates the energy loss of particles in all detector components and generates
the resulting scintillation photons and their propagation within the liquid
scintillator volume. The simulation accounts for absorption, reemission, and
scattering of the optical photons and tracks them until they either are
absorbed or reach the photocathode of one of the photomultiplier tubes. Photon
detection is followed by a comprehensive simulation of the readout electronics
response. The algorithm proceeds with a detailed simulation of the electronics
chain. The MC is tuned using data collected with radioactive calibration
sources deployed inside and around the scintillator volume. The simulation
reproduces the energy response of the detector, its uniformity within the
fiducial scintillator volume relevant to neutrino physics, and the time
distribution of detected photons to better than 1% between 100 keV and several
MeV. The techniques developed to simulate the Borexino detector and their level
of refinement are of possible interest to the neutrino community, especially
for current and future large-volume liquid scintillator experiments such as
Kamland-Zen, SNO+, and Juno.
