Thanks to director David Yates, the film version of the final battle of Hogwarts differs from its depiction in the books.

The conclusion of the battle between Harry Potter and Voldemort in Harry Potter and the Deathly Hallows: Part 2 differs from how the conflict is portrayed in the novel Harry Potter and the Deathly Hallows.
After seven films filled with magic and adventure, the war between Harry Potter and the Death Eaters led by Lord Voldemort will culminate in a final duel between the two rivals for all of the time.
When Harry and Voldemort have drawn their wands in the past, either one of them has been neutralized in some way, or someone else has intervened to help Harry. They have never fought each other head-to-head.
In the climactic scene of The Deathly Hallows – Part 2, the two competitors face off against one another, knowing that only one of them can emerge victorious from the battle.
In order to condense the original, epic-length Harry Potter novels into theatrical movies, the film adaptations of the series made alterations to the manner in which characters died, as well as moments and motivations that were important to them.
Even dividing Harry Potter and the Deathly Hallows into two parts is not enough to accurately portray all of the events that take place in the book. In addition to this, scenes that are successful in a book do not necessarily translate well to the screen.
Given that this is the last book in the acclaimed series, it was challenging to eliminate or change any of the scenes. Even though the final duel between Voldemort and Harry was always going to be an essential part of the narrative, director David Yates still needed to make some adjustments to ensure that it fit in more seamlessly with the film.
RELATED =>> Harry Potter Snape Death Scene Changed
Why Did the Final Battle of Hogwarts Between Harry and Voldemort Change?

Part 2 of Harry Potter and the Deathly Hallows picks up immediately after the events of the first book when Harry and his friends have just escaped Malfoy Manor. The Battle of Hogwarts takes up the majority of the running time of the film.
David Yates is forced to make imaginative adjustments in order to accurately portray J. K. Rowling’s words due to the fact that depicting a written battle on screen is significantly more challenging and expensive than describing one in a story.
In the 20th anniversary episode of Return to Hogwarts that aired on HBO, director David Yates stated that he “really wanted something earthier, more intense, and more visceral than [the book battle].” It was not an oversight; the director deliberately chose to stage the duel between Voldemort and Harry in a very different way than it is written. This was not an accident.
In spite of the fact that they are mortal enemies and are connected to one another through history and even blood, the two characters do not actually confront one another very frequently in the course of the franchise.
Yates came to the conclusion that, in order to properly conclude The Deathly Hallows: Part 2, he needed to ensure that viewers were aware of the significance of Voldemort and Harry Potter facing each other on an equal footing.
Yates made the decision to physically depict their profound connection by depicting two people fusing together in the form of an apparition. This addition to the scene in the book provides the characters with more time to spend alone together, while also enabling the movie to show, for the very last time, a bird’s-eye view of the primary setting.
How the Battle of Harry and Voldemort Differs From the Book

The conclusion of Harry Potter and the Deathly Hallows: Part 2 is identical to that of the book, but the journey to get there takes a slightly different turn. In the novel, Harry and Voldemort have a conversation about who the rightful owner of the Elder Wand is. It’s a great scene, but it wouldn’t translate well to the big screen.
This back-and-forth is represented in the book by the knockdown fight that takes place between Voldemort and Harry. Resurrection is a common plot device in contemporary media such as movies and television shows.
It was the right choice to make David Yates’s final change, which was to have Voldemort disintegrate rather than die as a man, in order to give the audience the confidence that the Dark Lord has been eliminated for good.