As covered in the accepted answer the shards of Narsil were reforged into Anduril while the original fellowship was still being formed in Rivendell.
Another departure between the book and the film is that, in the book Aragorn carried, at least the hilt of Narsil with him up to that point.
From 'Strider - FOTR' pp168 (2001 edition) : the chapter where the hobbits first meet Aragorn at the Prancing Pony in Bree.
'He stood up, and seemed suddenly to grow taller. I his eyes gleamed a
light, keen and commanding. throwing back his cloak, he laid his hand
on the hilt of a sword that had been concealed by his side. They did
not dare to move.....
...I did not know, he answered. 'But I am Aragorn, and the verses go
with the name.' He drew out his sword, and they saw that the blade was
indeed broken a foot below the hilt. 'Not much use is it Sam?' said
Strider. ' But the time is near when it shall be forged anew.'
In both the books and the film a lot hangs on Argorn's willingness/ability to take on his destiny as the King of Gondor/Arnor. In the books this gradually emerges over time, hinging on his decision to use the Palantir to directly challenge Sauron shortly after the destruction of Orthanc. In the films this is shifted to more of a defined moment of decision just before he take the paths of the dead and being given Anduril by Elrond.
This change is probably more about cinematic pacing for the films and puts a point of drama in what is otherwise a bit of a slow passage in the story and gives more prominence to the symbolism of the sword and the relationship between Aragorn and Arwen, which although important in the original story is somewhat overshadowed by other events and only really spelled out in the appendices.
As an aside it is also worth mentioning that the scene in the PJ films where Narsil is reforged (which I think only appears in the extended edition) bears very little resemblance to real world swordsmithing.