The genealogy makes a simple opposition impossible. Odin's mother Bestla is a jotunn, so the chief of the Aesir is half of that family himself. Loki, who lives among the gods and is counted with them, is the son of a jotunn father. Freyr sends a servant to win Gerd, a jotunn woman, and marries her. Skadi, whose father the gods have killed, arrives armed to demand compensation, and the settlement is that she may choose a husband from among them by looking only at their feet, plus the requirement that they make her laugh.
Against that, Thor is a specialist. His function in poem after poem is to go east and kill them, and the sources keep a running total in his own boasts.
At Ragnarok the jotnar come with the other forces arrayed against the gods, and one detail is worth keeping straight. Surtr and the sons of Muspell come from Muspellsheim, a realm of fire, which is not Jotunheim; Hrym leads a separate force by sea. The final battle gathers several distinct kinds of power that later summary tends to flatten into one enemy.
Modern scholarship is cautious about how much of the moral opposition is native and how much belongs to the recording. The Norse myths were written down in Christian Iceland by authors with a vocabulary of demons available to them, and the sharp division of gods against giants may be firmer on the page than it was in belief. What survives in the poems themselves is a rivalry between two related families over knowledge, marriage, property and precedence.