Intelligence is not the same as empathy
The need for empathy evolved as a way to work better as a group and keep babies alive. If you don't care at all about your tribe mates and they don't care about you, when your tribe gets attacked everyone just tries to save their own skin and collectively get slaughter by predator/enemy tribes. By design, empathy is stronger the more you can identify with the person/animal/thing (and how baby-like it looks), even humans don't see a problem with slaughter other humans and eat them as long as there's a strong us vs them dynamic between the groups, or at least a strong in-group cohesion. Plus, you know, if you need your group to survive, it's not a good idea to think of your buddies (or their kids) as emergency snacks.
Intelligence is simply the ability to solve problems and how to manipulate the environment to your advantage. Since knowledge can be passed down, intelligence will always benefit social animals more, as it is easier to share a breakthrough than it is to everyone to come up with the same idea. Nevertheless intelligence will benefit less social creatures just fine, parents will likely raise their kids and pass down their knowledge to them and, as long as they are not too territorial, they will still have plenty of opportunities to learn from other adults.
If your trolls live solitary lives, then I would expect their empathy towards things that don't look like babies to be reduced since cooperation and caring for your neighbor is not as crucial for survival. And besides...
Eating elves is a good idea all around
Assuming the troll and elves are both humanoids, I would expect that the two species have a great overlap of resources that they both need. Effectively, elves are competition, and competition is bad as you have to waste resource to win the competition and get the stuff you need/want. Now, there is a thing you can do that will both shrink the competition and get you resources. You guessed it, eat them!
You want them dead anyway, why not get a snack while you are at it? Once you remove the empathy barrier, living things that stop moving is just free food, assuming it hasn't die of disease, in that case it might be dangerous food. Serious, the list of things animals will eat include their own children has that just died, and if you think of it rationally it makes perfect sense! Intelligence is not the problem here.
They would not eat just elves...
The only problem with this framework is that pretty much any humanoid is food in potential, so what applies to elves probably applies to humans, dwarves, etc... Maybe the trolls prefer only eating elves because they are smaller than humans and their meat is not as hard as the dwarves, but I doubt they would pass away some human children lost in the woods. Maybe elves just happen to live closer to the trolls and thus are more attacked. Or maybe the elves are too afraid of getting eating to talk to them, so the trolls through diplomacy out of the window and start their fight or fight harder response, while other races are not as afraid and just stick by to a chat with the troll (as established they are not mindless beast).
For this kind of troll, I would look up the trolls of the witcher universe. They are more on the funny side when they are not murdering since they are not as intelligent, but I get a similar feeling out of them.