As other contributors have already pointed out, Grendel is acting out of envy and spite. Miserable, he lashes out at the Danes, jealous of the happiness which human beings can enjoy. In this sense, his attacks against Heorot reflect a deeply personal slight not only against the Danes, but also against the entire human condition, one which (I suspect) ties sharply to the poem's underlying Christian themes.
Remember, the universe of Beowulf is a Christian one, and Grendel's own background ties directly back to Judeo-Christian origins, given that Grendel himself is explicitly presented as a descendant of Cain. When reading this poem in a theological lens, Grendel actually appears to be one of the most fascinating characters in the entire saga, with his grudge against humanity, in particular, reflecting central concerns of the Christian universe.
Critical to this analysis is the concept of sin—more specifically, sin within the Augustinian mindset. Sin, as Augustine understood it, was a state of being, one built into the human condition and the entire natural order. Grendel, I would suggest, almost seems to embody this particular vision of original sin. For one thing, consider how his evil nature is described as being transmitted directly down to him through his descent from Cain (a descent which parallels the Augustinian notion of original sin, which itself traces this state of corruption back to Adam himself).
He is a creature entirely defined by his own malice: he is cruel, vicious, and sadistic. His evil is so all-encompassing that it defines his very nature and, loathing the humans that surround him (humans who moreover enjoy positive virtues and qualities that he can never possess), he attacks the Mead-Hall, looking to create as much suffering and misery as he can inflict.
The most obvious motive for Grendel's attack is envy and a sense of exclusion. He hears the laughter in the mead-hall, hates the Danes and their merry-making from which he is excluded, and resolves to kill them. Even slaughtering thirty does not satisfy him and he returns night after night to drown his misery in blood. Since he is always an outcast, however, the misery remains—no matter how many he kills.
I think, however, that this question and my answer above (as well as any other answers which invoke psychology and personality) would be equally incomprehensible to the poet or poets who composed Beowulf. For them and their audience, Grendel behaves monstrously because he is a monster: motiveless as a howling gale or a storm at sea. Grendel exists purely as an evil thing for the hero Beowulf to overcome. He attacks the mead-hall because the story demands that he should do so.
Grendel and his mother are purported to be monstrous demons and the descendants of the biblical Cain, who murdered his brother, Abel, out of jealousy. Cain was punished by God and left to wander the earth forever in suffering with no way of alleviating his pain. The literal reason Grendel has for attacking Herot is that he hears the songs of King Hrothgar's bard, which tell of God's creation of the world, and the sounds all of the hall's inhabitants engaging in their joyous feast. Grendel despises these people for their happiness because, through circumstances beyond his control, he has been condemned to a life of suffering and despair in the shadows, so, much like his forefather, he is driven by his jealousy to commit violent acts against those whom he sees as favored by God.
Grendel is the spawn of Cain, purely wretched by nature. His entire being is devoid of joy. Some think that when he hears the jubilant parties that take place at Herot he is filled with intense jealousy because he has never experienced anything happy. This jealousy may also be interpreted as hatred, which seems to present Grendel as pure evil, a rather one-sided view of the story. Some scholars prefer to present Grendel as a creature filled with bloodlust, but presenting him as a sad being without love experiencing envy seems to present a more complex story with more realistic emotions.
Yes, as an agent of evil Grendel does attack Herot because he hates/envies the happiness and prayers of the warriors who reside there. One additional comment to make is that Hrothgar and his people are shocked not by just Grendel's carnage and bloodlust but also because there is no way to make amends with him. There is nothing they can do to stop him. His motive are not clear. There is no price they can pay to stop the murders (note how Hrothgar once helped buy peace between Beowulf's father and rival people). This makes the attacks that much more difficult for Hrothgar and his people.
Grendel attacks because he is evil (spawn of Cain) and hates the happiness and noise of the men at the hall. He attacks killing 30 men, and then goes back the next night for more. The only way men can stay alive is to leave the hall.
In order to understand Grendel's motivation for his attack on Heorot, we need to examine Grendel's origins. For example, within the first 120 lines of the poem, we learn
That fiend from Hell,/that grim spirit, was called Grendel. . . . With fulsome monsters/this sorrowful man had stayed awhile,/since the Shaper [God] had condemned him/as Cain's kinsman. (ll. 101-107)
Because Grendel is related to Adam's son, Cain, who killed his brother Abel and was therefore cursed by God, Grendel was also banished "away from humankind" (l.110). At the same time, the poet tells us that "misbegotten creatures came to life then," and Grendel, described as "this sorrowful man," spent his time among these monsters and, over time, became one of them.
The key to Grendel's nature, as well as his behavior, is that he was once a man who has been banished from the world of men and has lived with monsters so long--who are at war with God--that Grendel too becomes a monster at war with mankind. We see this in his approach to Heorot when Hrothgar's men, "the Ring-Danes after the beer-party," went to sleep:
The sinful creature,/grim and greedy, was instantly ready,/savage and spiteful. . . . (ll.120-122)
In other words, Grendel's attack on Heorot is simply an act of spite. He attacks men because he knows that he can no longer share in the camaraderie and celebrations of mankind. And this spite is all the stronger because Grendel knows that he was once part of mankind and is forever shut out of that fellowship.