Astroparticle physics is undergoing a profound transformation, due to a series of extraordinary new results, such as the discovery of high-energy cosmic neutrinos with IceCube, the direct detection of gravitational waves with LIGO and Virgo, and many others. This white paper is the result of a collaborative effort that involved hundreds of theoretical astroparticle physicists and cosmologists, under the coordination of the European Consortium for Astroparticle Theory (EuCAPT). Addressed to the whole astroparticle physics community, it explores upcoming theoretical opportunities and challenges for our field of research, with particular emphasis on the possible synergies among different subfields, and the prospects for solving the most fundamental open questions with multi-messenger observations