Djokovic had three chances to lead Serbia to the Davis Cup final, but Jannik Sinner's comeback leveled the match at 1-1.
Sinner's victory in doubles secured Italy's 2-1 comeback win, putting them in the final for the first time since 1998.
Djokovic's hopes of capping a superb season with a Davis Cup final appearance were dashed.
Miomir Kecmanovic gave Serbia a 1-0 lead, but Sinner's win in the second singles match turned the tide.
Italy will face Australia in the final, with Sinner avenging his recent loss to Djokovic in the ATP Finals.
Djokovic expressed disappointment at missing the opportunity to lead Serbia to its first Davis Cup final in a decade.
Sinner highlighted the importance of the team competition and the energy from teammates and the crowd.
Djokovic congratulated Italy, acknowledging their strong performance, especially by Jannik Sinner.
The doubles match saw Djokovic gesturing to the crowd during tense moments when they were shouting.
Djokovic recently became the most successful Serbian player in the Davis Cup with his 44th victory.