Violence against Muslims in India was also reported after the emphatic 10-wicket win on Sunday, Pakistan's first against India at any World Cup.
Cricket clashes between Hindu-majority India and Muslim Pakistan frequently heighten tensions between the neighbours, who have fought three wars since their independence in 1947.
The 31-year-old Shami became the main target after the defeat in Dubai, even though India captain Virat Kohli acknowledged that his side had been "outplayed".
Hundreds of messages were left on Shami's Instagram account saying he was a "traitor" and should be thrown out of the Indian team.
But many fans and politicians also urged support for him, calling on Indian players to reject the hate messages just as they had backed the Black Lives Matter movement by taking a knee.
"Team India your BLM knee-taking counts for nothing if you can’t stand up for your teammate who is being horribly abused and trolled on social media," Omar Abdullah, a former chief minister in the Muslim-majority region of Kashmir, said on Twitter.
"Ignore the haters, most of India's grateful for your effort," said another supporter on Instagram.
Also read: ‘Moment to cherish’: Ramiz Raja opens up after Pakistan’s win over India
People set off celebratory gunfire in the Pakistani cities of Islamabad and Karachi after the famous win, while hundreds ignited firecrackers in Muslim-majority Indian Kashmir, where troops are fighting an insurgency.
Gautam Gambhir, a former India Test cricketer who has become an MP for the ruling Hindu nationalist Bharatiya Janata Party, said it was "shameful" that people were celebrating Pakistan's win.
In Punjab state students from Kashmir said they were beaten up.
A student at an engineering and technology institute said dozens of men armed with hockey sticks and batons attacked them as they watched the closing stages of the game.
"They entered our room, switched off the lights and beat us. They destroyed our laptops," the student told AFP, speaking on condition of anonymity because of fears of more trouble.
"We are safe now and we have support from our college. But we didn't expect this at all. We are Indians."
The match also sparked violence in neighbouring Bangladesh. Two Pakistan supporters were beaten by India fans as they celebrated the win in one southern district, media reports said.