Are they not happy in the body of swines?
Demons are not capable of happiness, none of the Damned are. They are forever tormented by the fires of Hell, no matter where they geographically may be. The fires of Hell are spiritual pains, coming as a result of their own pride. When a proud soul sees God, it will not be able to cope, and rather than rejoicing in God’s greatness, it will despair at it’s own comparable lowliness.
Therefore, when a demon finds someone smaller than itself, it will be of some comfort to their pride if they exercise their superior power to control them. This does not necessarily mean possession, as that is but one of many ways demons manipulate us.
Animals meet the same criteria of being lesser than demons, but because of their pride a demon will never bother tormenting an animal except when doing so can be useful in tormenting a person. So when Legion entered the swine their purpose was never to live peacefully as simple pigs, but to torment humans.
They probably knew, like Jesus, that the herd would be driven mad by their possession, and if it was not the pigs themselves that ran of the cliff then I’m sure the demons would have done so anyway. They asked Jesus to let them do this last act of malice, showing us that no one, not even demons, can act without the permission of God.
And Jesus let them, and though we do not know why, it is not hard to think of possible answers. This story tells us much of what we need to know about demonology, and a prayerful meditation on this text will give many insights into how God views those that reject him.