They’re both potentially correct, but have different meanings. The first one would be the most useful one for most people.
Coming to the party: The party (celebration / get-together, etc.) is treated like a place — John’s destination.
Coming in the party: The party is a group of people, for example, “a party of four”. If John is coming in the party, it means he is part of the group that is coming.
We could use both in the same sentence (although it sounds kind of silly): John is coming in the party (i.e. with the group) to the party (i.e. to the get-together).