What is the reason/motivation for the prevalence of tentacles (possibly NSFW Wikipedia link) in anime (esp. hentai)?
Did the anime subculture lead to it or does it stem from various aspects (possibly obscure) of Japanese art/culture?
Toshio Maeda, the manga artist who did Urotsukidoji, one of the first shows to use tentacles, said in an interview that he used tentacles to circumvent the Japanese censorship laws which prohibit the depiction of male genitalia.
Why tentacles? For some reason there were some issues about censorship about the sex scenes. When I was drawing sex scenes, sensual scenes in bed, editors always asked me not to be so extreme. Of course we couldn't depict genitals, and if you can't see their genitals, it's not so good. And why they are so fussy about that was because they were the ones who would get arrested. We are not, always we have the freedom to express ourselves – freedom of speech, I think you really respect that in America (laughs). So actually we mangaka didn't give a shit about that, but the editors, they really cared about that, so they always said, “Please, not extreme.” But when we toned ourselves down, they said, “Come on, you should do more.” So that's why I did the tentacle thing. Because tentacles are not genitals. They are parts of the body, and some creatures have more than one. Because they are not genitals, they are like hands and legs or like uh, just body parts, so it's ok to go there. And attacking ladies with tentacles is not just part of a sex scene, you can see that. It's just outdoor things. So it was kind of a flimsy excuse for drawing that. (laughs)
After that, it caught on and is memetic in anime. It's phallic and can be used to imply something sexual, cue something "naughty", or even as fan service to poke fun at the culture.
Going one step over, here's the reason of the censorship, according to this article:
According to Bennett, one of the actions taken by Allied forces after World War II was to ban pornography in Japan. As Japan was a very sexual culture prior to the war, occupying forces blamed porn for the aggressive and expansionary tendencies of the Japanese Empire, and the ban was created to curb their combative nature. That being said, it's illegal for genitalia, real or animated, to be featured in entertainment; a ban that over sixty years later is still in place.
Going back to that damn Allied anti-porn law, penises and vaginas were parts non-grata in Japanese entertainment. But those meddling Yankees didn’t say a Cthulu-damned thing about tentacles. In fact, so long as it’s attached to a monster, it doesn’t count.
The other answers are also correct, but a significant player in the tentacle's popularity was the anime Urotsukidoji - Legend of the Overfiend 1987 which was one of the first hentai to feature tentacles.
The reason it was so influential is that its sales were very good. Especially in the West, where it got a lot of media attention for its gore and rape scenes. Of course, this only drove more sales for the show. In Britain, it sold 40,000 copies at a time when the average convention was about 500 in attendance. For comparison, the only animated feature that sold more than this (by 1998 at least) was Akira.
(Ref: Schoolgirl Milky Crisis: Adventures in the Anime and Manga Trade )
It was this show that started the term 'tentacle rape' and is also the source of early bad reputation for anime in Britain, and elsewhere.
As hentai shows were quite new then (The first hentai anime débuted in 1984), the commercial success of the overfiend probably contributed heavily to it's future repeated use in erotic animation.
Other Reference:
The Animated Movie Guide By Jerry Beck