The 2-body hyperon-nucleon interaction softens the equation of state of neutron star matter and leads to the maximum mass of neutron star to be 1.3-1.6M⊙, which deviates from the recent observation with the masses of PSR J0348+0432 (2.01±0.04M⊙) and J0740+6620 (2.14−0.09+0.10M⊙). One attempt is to introduce the more repulsive hyperon-nucleon interaction above the saturation density. A phenomenological Λ potential by fitting the 3-body ΛNN results of chiral effective field theory is implemented into the quantum molecular dynamics transport model to solve the ‘hyperon puzzle’ in neutron stars. It is found that the directed and elliptic flows are sensitive to the high-density hyperon-nucleon potentials in collisions of 197Au + 197Au and 124Sn + 124Sn. The influence of the phenomenological potential on the Λ yields, rapidity distributions and transverse momentum spectra is negligible in comparison with the ones calculated by the well-known relativistic mean-field model. The inclusion of the ΛN, ΣN and ΞN potentials leads to the reduction of hyperon production in the midrapidity region. The Λ directed flows and the slope in the midrapidity region are enhanced with the phenomenological potential and more consistent with the STAR data in collisions of 197Au + 197Au at sNN=3 GeV.