The Wyoming territory is vast, rich with grasslands, and largely lawless. So when a conflict arises over whose herd gets to graze in those grasslands, then it's more likely to be settled with a shootout than a lawyer.
The cattlemen believed their cows ought to have free grazing. It had been a long winter and the herd was hungry. But that means the sheep ranchers would have to move on, at gunpoint if necessary. But the way the sheep ranchers see things, they were there first, and the cowboys ought to be the ones looking for greener pastures. After the sheep ranchers refused to leave, night riders ambushed them, killing a sheep rancher and a shepherd as proof that the edict to leave was serious.
But without the law to intervene in the conflict, there was only one way the showdown in Wyoming could be brought to an end: guns.