Jurgen Klopp will take his Liverpool team back to his native Germany for the first leg on August 15 or 16 with the return at Anfield a week later.
Hoffenheim, whose Rhein Neckar Arena is in Sinsheim in south-west Germany, are in the Champions League for the first time in their history after finishing fourth in the Bundesliga last season.
Their coach Julian Nagelsmann, who turned 30 last month, is one of the most highly-rated young trainers in the game.
Liverpool finished fourth in the Premier League last season. The five-time European champions were last in the Champions League in 2014-15, when they failed to make it out of their group.
Spanish side Sevilla have been drawn against last season’s Turkish league runners-up Istanbul Basaksehir, who boast the likes of Emmanuel Adebayor and Gael Clichy in their ranks and eliminated Club Brugge in the third qualifying round.
Napoli, who came third in Serie A last season, were handed a difficult draw against Nice, third in France’s Ligue 1 and victors against Ajax in the third qualifying round.
Scottish giants Celtic, who were in the section of the draw reserved for domestic champions, must once again beat Astana of Kazakhstan if they are to return to the group phase.
The Glasgow club will host Astana in the first leg before a journey of nearly 4,000 miles for the return leg on August 22 or 23.
Celtic won 3-2 on aggregate when the teams met in the third qualifying round last season.
Draw for the UEFA Champions League play-off round:
Qarabag (AZE) v FC Copenhagen (DEN)
APOEL (CYP) v Slavia Prague (CZE)
Olympiacos (GRE) v Rijeka (CRO)
Celtic (SCO) v Astana (KAZ)
Hapoel Beer-Sheva (ISR) v Maribor (SLO)
Istanbul Basaksehir (TUR) v Sevilla (ESP)
Young Boys (SUI) v CSKA Moscow (RUS)
Napoli (ITA) v Nice (FRA)
Hoffenheim (GER) v Liverpool (ENG)
Sporting (POR) v FCSB (ROM)
First legs will be played August 15/16, second legs August 22/23