The paper discusses dynamics of charged particles and neutrons in boron neutron capture therapy system (BNCT) as well as geometrical and physical optimization of BNCT system elements. Our choice is BNCT system with linear accelerator. BNCT track includes ion injector, RFQ, DTL, neutron-producing target and neutron moderator which provides an exit (last collimator) flux of epithermal neutrons satisfied to International Atomic Energy Agency (IAEA) requirements. The following software tools IBSimu, LIDOS, COMSOL Multiphysics and PHITS were used for modelling BNCT system.