The 18-year-old, who finished eighth in the same event at the 2018 Youth Olympic Games in Buenos Aires three years ago, beat off the challenge of Australian Jack McLoughlin and the American Kieran Smith to win the Gold Medal.
After a stunning first 200m that was under world-record pace, times slowed in the second half of the race. However, Hafnaoui grew stronger over the last 50 metres, touching the wall in three minutes and 43.36 seconds.
Hafnaoui came to the final as the underdog, having qualified eighth from the preliminaries with a time of 3:48.68s.
The Tunisian teenager has strong sporting genes with his father Mohamed Hafnaoui a former member of the national basketball team.