You gain knowledge of how things work, even if it's not anything that can be learned implicitly by looking at the insides of something you can get a general idea of how pieces fit together and can hopefully take something away from it that you might not have known before.
Also you gain skill of knowing that you can take something apart and be able to put everything back together again, which is often harder than it sounds.
The answer that's related that I was trying to elicit is "because it interests me to know how things work." By the same token, trolls derive the same sort of intellectual pleasure from trolling: to anger someone is to own them. They do it "because I can."
Real trolls aren't the ones that are going "lulz obama is a socialist," "ruby is better than python," or anything so obvious. The real trolls are the ones that sound reasonable, but slowly end up destroying your community by creating discord much more subtly.