A search for flavour-changing neutral-current decays of a top quark into an up-type quark (either up or charm) and a light scalar particle X decaying into a bottom anti-bottom quark pair is presented. The search focuses on top-quark pair production where one top quark decays to qX, with X → boverline{b} , and the other top quark decays according to the Standard Model, with the W boson decaying leptonically. The final state is thus characterised by an isolated electron or muon and at least four jets. Events are categorised according to the multiplicity of jets and jets tagged as originating from b-quarks, and a neural network is used to discriminate between signal and background processes. The data analysed correspond to 139 fb−1 of proton–proton collisions at a centre-of-mass energy of 13 TeV, recorded with the ATLAS detector at the LHC. The 95% confidence-level upper limits between 0.019% and 0.062% are derived for the branching fraction mathcal{B} (t → uX) and between 0.018% and 0.078% for the branching fraction mathcal{B} (t → cX), for masses of the scalar particle X between 20 and 160 GeV.