see the definition of closed, open or modified primaries to get a better understanding
(very simplified)
closed=
republicans vote for republican candidates
dems vote for dems
winners run against each other
open=
anyone can vote in primary without declaring a party
leads to voters from one side voting in the other parties primary
to defeat someone they do not want to run against