Here is a list of all hat-tricks in World Cup matches, as on June 22 2019:
Live link: http://stats.espncricinfo.com/ci/content/records/1190325.html
The first as well as the most recent instances were by Indian bowlers.
The first one was by a bowler who is not always given the credit he deserved. He is unfortunately remembered more for a last-ball six by Javed Miandad in a crucial match.
It may not be remembered that he is still the only Indian bowler to take a 10-for in a Test in England. And that he is one of the few Indian tailenders who scored an ODI century when tried in the middle order.
See the overview:
And his World Cup hat-trick in 1987. No one else had taken a hat-trick in the World Cup until then in matches starting from 1975.
See the scorecard:
That match on Oct 31, 1987 was critical, as it was India’s last match in the group and needed to defeat New Zealand by a large margin to ensure that they topped the group. If they came second, they would have to face Pakistan in the semi-final (which, by prior agreement, would have been held in Pakistan if the two teams were to meet).
New Zealand won the toss and batted first. They made steady and unspectacular progress until they reached 182/5. One of their key batsmen Ken Rutherford was batting along with pinch-hitter Martin Snedden. Chetan Sharma had not taken a wicket at that stage.
He then had Rutherford bowled, followed by bowling No 8 Ian Smith (a Test centurion) and No 9 batsman Ewan Chatfield (capable of stubborn batting). This would be one of the relatively rare all-bowled hat-tricks in international cricket.
From 182/8, they got up to 221/9 in 50 overs.
This is still the only World Cup hat-trick where all three dismissals were bowled.
The Indian team knew the required run rate. Sunil Gavaskar had not been much of a success as an ODI batsman, but seized the occasion to score his only ODI century, an unbeaten 103. Srikkanth (75) and Azharuddin (41*) also ensured that India met the required run rate. Gavaskar and Sharma shared the Man of the Match award.
So it was India vs England at Bombay, and Pakistan vs Australia at Lahore. We all know how THAT turned out. So there was an Ashes final rather than a South Asian final at Calcutta, where Border’s unheralded team won by a narrow margin.
Hat-tricks in World Cup matches remained scarce, with no instance in 1992 and 1996. The next instance was by Saqlain Mushtaq in a Super Six match against Zimbabwe in 1999.
Forward to 2019. Mohammad Shami had made a good beginning to his Test career (with a 9-wicket haul against an admittedly weak WI team) but was generally felt to have performed below expectations. He did score a fifty in a Test batting at no 11. Injuries and domestic issues played their role.
There was even some kind of fudging in his records as his birthplace was initially shown to be in Jonagar in Bengal. No such town can be found in the map. Later his birthplace was mysteriously changed to Amroha (near Moradabad in UP) which is generally considered to be correct.
From the table in the beginning, we see that hat-tricks in the World Cup had become more common since 1999, with Malinga going a step beyond with 4 in 4. That is the only such dismissal in ODIs (or Tests). Malinga also took two regular hat-tricks later.
As I write this on June 23, the result of the 2019 World Cup is unknown. The only thing we know definitely is that Afghanistan (0 points in 6 matches) cannot qualify.
Points table after matches on June 22, 2019:
In this match India batted below par and finished with 224/8, primarily due to lower-order failures. Shami’s dismissal was typical as he scored 1 off 2 balls.
Some time later the unthinkable seemed likely as Afghanistan made good progress towards the modest target. Shami had earlier taken the first wicket of H Zazai. With an over left, Afg was 209/7 with Nabi and Ikram going strong.
The upsets by Bangladesh against WI and Sri Lanka against England were fresh in viewer’s minds.
16 in the last over was difficult but not impossible (as Dinesh Karthik would testify). With the 3rd ball, Shami had Nabi caught by Pandya for 52 (213/8). 12 to get off 3 balls with 2 wickets in hand.
Surely that was the end for Afghanistan’s hopes? Shami made sure of that by bowling No 10 (Aftab 49.4) and No 11 (Mujeeb, 49.5) and taking India’s second hat-trick in the World Cup, over 31 years after the first. He finished with 4-40.
Also see this: https://www.espncricinfo.com/story/_/id/27035426/mohammed-shami-reveals-ms-dhoni-advice-world-cup-hat-trick-ball
However, it was JJ Bumrah (2-39) who was Man of the Match as his wickets were probably more critical.