CERN-LHC. Heavy flavour hadron production provides information about the transport properties and the microscopic structure of the quark-gluon plasma created in ultra-relativistic heavy-ion collisions. A measurement of the production of muons from the semi-leptonic decays of charm and bottom hadrons in Pb+Pb and pp collisions at a nucleon-nucleon center-of-mass energy of 5.02 TeV with the ATLAS detector at the Large Hadron Collider is presented. The Pb+Pb data were collected in 2015 and 2018 with sampled integrated luminosities of 208 mub^-1 and 38 mub^-1, respectively, and pp data with a sampled integrated luminosity of 1.17 pb^-1 were collected in 2017. The differential muons yield in Pb+Pb and pp cross section are measured in the transverse momentum range from 4 GeV to 30 GeV and pseudorapidity interval up to 2. Muons from heavy flavour semi-leptonic decays are separated from the light flavour hadronic background using the momentum imbalance between the inner detector and the muon spectrometer measurements, and muons coming from charm and bottom decays are further separated via the muon track transverse impact parameter. The nuclear modification factor for the charm and bottom muons is presented as a function of the muon transverse momentum in intervals of Pb+Pb collision centrality. The measured nuclear modification factors quantify significant suppression of the yields for muons coming from the decays of charm and bottom hadron, with stronger effects for muons coming from charm hadron decays.