  This paper presents a measurement of $b$-jet production in Pb+Pb and $pp$
collisions at $\sqrt{s_{_\textrm{NN}}}=5.02$ TeV with the ATLAS detector at the
LHC. The measurement uses 260 $\textrm{pb}^{-1}$ of $pp$ collisions collected
in 2017 and 1.4 $\textrm{nb}^{-1}$ of Pb+Pb collisions collected in 2018. In
both collision systems, jets are reconstructed via the anti-$k_{t}$ algorithm.
The $b$-jets are identified from a sample of jets containing muons from the
semileptonic decay of $b$-quarks using template fits of the muon momentum
relative to the jet axis. In $pp$ collisions, $b$-jets are reconstructed for
radius parameters $R= 0.2$ and $R= 0.4$, and only $R= 0.2$ jets are used in
Pb+Pb collisions. For comparison, inclusive $R= 0.2$ jets are also measured
using 1.7 $\textrm{nb}^{-1}$ of Pb+Pb collisions collected in 2018 and the same
$pp$ collision data as the $b$-jet measurement. The nuclear modification
factor, $R_\textrm{AA}$, is calculated for both $b$-jets and inclusive jets
with $R= 0.2$ over the transverse momentum range of 80--290 GeV. The nuclear
modification factor for $b$-jets decreases from peripheral to central
collisions. The ratio of the $b$-jet $R_\textrm{AA}$ to inclusive jet
$R_\textrm{AA}$ is also presented and suggests that the $R_\textrm{AA}$ for
$b$-jets is larger than that for inclusive jets in central Pb+Pb collisions.
The measurements are compared with theoretical calculations and suggest a role
for mass and colour-charge effects in partonic energy loss in heavy-ion
collisions.
