Pastel literally means "cake". While it's a common word, its use in this song is part of a very interesting and unique idiomatic expression: "comerse el pastel" (to eat the cake).
In the context of the song, "que por pendejo le comieron el pastel" means that because he was foolish, someone else "ate his cake," implying that his girlfriend was taken by another man. It's a colorful and memorable way to describe being outsmarted or losing something valuable due to one's own negligence.
"Le Comieron El Pastel" is a boastful banda track about winning someone away from a partner who didn't treat her right.
The title is a Mexican slang expression that means someone got outplayed and lost what was theirs, roughly "they ate his cake right in front of him." The singer taunts the old partner, saying he was careless and let a good thing go, while he steps in and takes over.
Through the song, he promises to treat her better, calling it "one good thing to make up for all the bad" she went through before. He tells her she deserves it after everything she put up with, and warns that anyone watching now will understand exactly why she left.
It's a confident, playful kind of bragging song, common in banda and corridos, about coming out on top in a love triangle.