late 14c., "to go about, stroll," later (early 15c.) "roll from side to side, trundle," probably from Old French troller, a hunting term, "wander, to go in quest of game without purpose" (Modern French trôler), from a Germanic source (compare Old High German trollen "to walk with short steps"), from Proto-Germanic *truzlanan.
Sense of "sing in a full, rolling voice" (first attested 1570s) and that of "fish with a moving line" (c. 1600) both are extended technical uses from the general sense of "roll, trundle," the former from "sing in the manner of a catch or round," the latter perhaps confused with trail or trawl. Figurative sense of "to lure on as with a moving bait, entice, allure" is from 1560s. Meaning "to cruise in search of sexual encounters" is recorded from 1967, originally in homosexual slang.
The internet sense (everyone seems to have his own definition of it) seems to date to the late 1980s or early 1990s and the Newsgroups era, and the verbal use is perhaps older than the noun. It seems to combine troll (v.) in the "fish with a moving line" sense (itself confused with trawl) and troll (n.1) "troublesome imp supposed to live underground."