Searches are performed for nonresonant and resonant di-Higgs boson production in the final state. The data set used corresponds to an integrated luminosity of 139 fb of proton-proton collisions at a center-of-mass energy of 13 TeV recorded by the ATLAS detector at the CERN Large Hadron Collider. No excess above the expected background is found and upper limits on the di-Higgs boson production cross sections are set. A 95% confidence-level upper limit of 4.2 times the cross section predicted by the Standard Model is set on nonresonant production, where the expected limit is 5.7 times the Standard Model predicted value. The expected constraints are obtained for a background hypothesis excluding production. The observed (expected) constraints on the Higgs boson trilinear coupling modifier are determined to be at 95% confidence level, where the expected constraints on are obtained excluding production from the background hypothesis. For resonant production of a new hypothetical scalar particle (), limits on the cross section for are presented in the narrow-width approximation as a function of in the range GeV. The observed (expected) limits on the cross section for range from 610 fb to 47 fb (360 fb to 43 fb) over the considered mass range.