Harry inadvertently summoned the bus by waving his arm around.
Harry stepped backwards. His legs hit his trunk and he tripped. His
wand flew out of his hand as he flung out an arm to break his fall,
and he landed, hard, in the gutter.
HP and the Prisoner of Azkaban
and
For witches and wizards who are Floo-sick, whose Apparition is
unreliable, who hate heights or who feel frightened or queasy taking
Portkeys, there is always the Knight Bus, which appears whenever a
witch or wizard in urgent need of transportation sticks out their wand
arm at the kerb.
Pottermore: The Knight Bus by JK Rowling
and
’Ere,’ he said, looking suspicious again, ‘you did flag us down, dincha? Stuck out your wand ’and, dincha?’
‘Yes,’ said Harry quickly. ‘Listen, how much would it be to get to London?’
Harry Potter and the Prisoner of Azkaban - Chapter 3: The Knight Bus
Note that in the novel his goal wasn't to get to the Leaky Cauldron, it was to get to his money in Diagon Alley.
They were thundering along Charing Cross Road. Harry sat up and
watched buildings and benches squeezing themselves out of the Knight
Bus’s way. The sky was getting a little lighter. He would lie low for
a couple of hours, go to Gringotts the moment it opened, then set off
– where, he didn’t know.
Harry Potter and the Prisoner of Azkaban - Chapter 3: The Knight Bus
Whereas in the film he simply names somewhere in London that he knows will be amenable to magic folk.
STAN SHUNPIKE: Whereabouts you headin'?
[Harry hesitates. He hadn't thought about this. Decides.]
HARRY: The Leaky Cauldron. That's in London --
HP and the Prisoner of Azkaban - Original Screenplay