Anemones belong to the phylum Cnidaria, whose distinguishing feature is the adaptation of nematocysts. These are little cells located on tentacles which consist of a trigger-hair known as a cnidocil, a pointed barb attached to a coiled string and a sac of venom. When tissue from another organism triggers the cell, the barb proceeds to penetrate and inject the venom. Tentacles on anemones are covered in these cells, yet the humble clownfish has developed means to avoid this toxic hazard. There are over a 1,000 species of anemone (incidentally clownfish happen to inhabit only 10 of these) and they live in tropical environments relying on the sunlight in the same way that hard and soft corals do.
For a while marine ecologists were stumped as to how the anemone fish avoided the danger posed by the anemones. There were several theories: first off, that the tentacles of the 10 host anemone species have somehow evolved not contain nematocysts; secondly that the clownfish do not actually touch the anemones' tentacles; that the skin of clownfish is thicker than that of other damsels and other reef fish; or finally that the anemones choose not to fire when the clownfish is present. All of these were found to be wrong - the 10 host anemones all contain nematocysts; the clownfish do indeed touch the tentacles (although it is true that other species such as the three-spot dascylus will hide behind anemones for protection without venturing within the tentacles); the skin of clownfish is in no way noticeably thicker than any other fish species of the same size; and while anemones appear to have the ability to control whether their nematocysts fire or not it has been observed that they can sting and consume in a predatory manner while a clownfish is simultaneously nestled within their tentacles.
Yet the anemone fish get protection somehow. In laboratory experiments clownfish that were separated from their host anemones for merely a few days appeared to swim away from the anemone rapidly in a manner befitting a painful sting after they had been reunited. A stung anemone fish would then be seen to return to the anemone tentatively, perhaps to gradually expose itself to the stings of the host; ventral fins first, then after a while, the whole belly. Most scientist currently believe that the mucus secreted by the clownfish serves to prevent the nematocysts firing - either by disguising it from the stinging cells, a sort of chemical camouflage - or indeed by acting as a barrier for the fish, preventing the venom from entering. This mucus has to be constantly secreted by the fish so that it remains protected. In the famous aforementioned movie there is a seen where Nemo's father tells him to rub the anemone in the morning to remain immune to the sting - it would seem this is surprisingly accurate.
Clearly the poison of the anemones serves to protect the clownfish from its predators, a very useful ecological advantage for an otherwise rather defenseless fish. This is an example of symbiosis - interactions between two species that live along side each other. Rather than being mutualistic (where both parties benefit) this is an example of a commensal relationship; the clownfish provide very little positive feedback to their hosts. While it is true that some individuals will bring food to the anemones, this is nowhere near substantial. Anemones themselves are capable of stinging and capturing prey with their tentacles, provided it is small enough to fit in their mouths. On top of this they also often play host to photosynthetic algae that provide them with glucose (this is another example of symbiosis). Perhaps this is why clownfish are so protective of their homes, scaring away the majority of fish that swim by, occasionally braving an aggressive swim at a passing diver.