Serbia's Djokovic, 35, lost the first set after some superb serving from Kyrgios, but ended up winning 4-6 6-3 6-4 7-6 (7-3) on Centre Court.
It is Djokovic's seventh SW19 men's title and only Roger Federer has more.
Victory also moved him one behind Rafael Nadal's record 22 men's majors.
Top seed Djokovic made a slower start than his 27-year-old opponent, who initially seemed nerveless in his first Grand Slam singles final.
But the Serb did not lose belief as he showed all of his experience and nous to turn the match around.
"He's a bit of a god, I'm not going to lie. I thought I played well," Kyrgios said as he congratulated Djokovic.
Losing his winning position began to irritate Kyrgios, who is known for his fiery temperament as well as his exciting tennis.
While Kyrgios increasingly remonstrated with his support team, Djokovic remained cool in the heat of the battle on a scorching Centre Court.
After clinching victory with his third match point, Djokovic dropped to his haunches and picked a blade of the Centre Court grass to eat in what has now become a customary celebration.
It was a first major win of the year for the Serb, who was stopped from playing in the Australian Open after being deported because of his vaccination status, and lost to Rafael Nadal in the French Open quarter-finals.
In temperatures passing 30C in London, a 15,000 near-capacity crowd including royals and celebrities were enthralled in what was surely the hottest ticket in town.
Djokovic had joked there would be "fireworks" in a match against a player who, like him, has shown the tendency to be combustible on the court.
The pair have also had an uneasy relationship in the past, with Kyrgios last year branding Djokovic a "tool" and a "strange cat".
The tension had eased at the All England Club, with Kyrgios revealing a "bromance" had developed between the pair before they were seen joking together at their practices on Saturday.
The relationship remained cordial when the serious business began on Sunday, both knowing that losing their cool could provide encouragement to their opponent.
Kyrgios, who had spoken about struggling to sleep because of the excitement of reaching his first major singles final, initially did well to keep his emotions in check.
But, as the momentum of the match began to turn, Kyrgios took his frustration out on his family and friends.
Having so far been calm and reserved, he began chuntering and gesturing at them midway through the second set.
The frustrations reappeared as the third set and fourth-set tie-break moved away from him, with the steely Djokovic drawing out mistakes to seal a 21st major title with the third of five championship points.
Djokovic roared towards his box in delight at clinching victory, then put his arm around Kyrgios, who smiled as he received some words - seemingly of encouragement - from his opponent.
In his on-court victory speech, Djokovic told Kyrgios he would "be back" in a major final.
"It is tough to find consolation words at a moment like this but you showed why you are one of the best players in the world," he said.
"I wish you all the best. I respect you a lot and you are a phenomenal talent.
"I never thought I would say so many nice things about you! OK, it's official: it is a bromance."
Kyrgios had beaten Djokovic in both of their previous two matches, which came in three-set matches on hard courts.
Playing Djokovic over five sets on grass was always likely to be a different proposition.
Djokovic had not lost a match at Wimbledon since 2017 - when he retired from a quarter-final against Tomas Berdych - and was going for his 28th consecutive victory on the surface.
But Djokovic - regarded as the game's greatest returner - could not live with Kyrgios' serve as the world number 40 made a superb start.
Kyrgios broke for a 3-2 lead on the way to taking the opening set and dropped just five points on serve, hitting seven aces and winning 81% of his first-serve points.
A delicately-poised third game of the second set swung Djokovic's way as he outlasted Kyrgios in a 23-shot rally and then ended another long duel with a sublime drop shot to clinch the break.
That set the platform for the world number three, now fully dialled in, to swing the second set in his favour.
Djokovic was unable to convert either of two break points in the first game of the third set, shortly before the match was briefly disrupted by a protester in the stands who was removed from Centre Court by security.
Djokovic continued to make Kyrgios work hard for his holds but the set continued on serve until a ninth game where the Australian produced a double fault for break point and then hit a backhand into the net.
While Kyrgios ranted again at his box, Djokovic remained calm on his chair as he prepared to serve out for the lead.
The Serb managed to block out the drama from his opponent to clinch the third set and, in a sign of his focused state of mind, celebrated with a gentle shake of his racquet.
Neither player made much of an impression on the other's serve in the fourth set, leading to a tie-break where Djokovic drew more errors to clinch victory.
Nine-time Wimbledon doubles champion Todd Woodbridge on BBC TV
Kyrgios came out as he had to, to put the pressure on the champion, with an exceptional array of shots. But then Novak, who we have seen so many times before, came through with the consistency, the determination and the accuracy.
There's no indication of Djokovic slowing down. His intention is to continue to go after that (Grand Slam) record. He's got a little closer again now. But when you watch him here on the grass, there's a lot of work to be done by the rest of the field to be able to beat him here at the Championships.