The whale shark is a filter feeder - one of only three known filter feeding shark species (along with the basking shark and the megamouth shark). It feeds on phytoplankton, macro-algae, plankton, krill and small nektonic life, such as small squid or vertebrates. The many rows of teeth play no role in feeding - instead the shark sucks in a mouthful of water, closes its mouth and expels the water through its gills. During the slight delay between closing the mouth and opening the gill flaps, plankton is trapped against the dermal denticles which line its gill plates and pharynx. This fine sieve-like apparatus, which is a unique modification of the gill rakers, prevents the passage of anything but fluid out through the gills (anything above 2 to 3 mm in diameter is trapped). Any material caught in the filter between the gill bars is swallowed. Whale sharks have been observed "coughing" and it is presumed that this is a method of clearing a build up of food particles in the gill rakers. The shark can circulate water at a rate up to 1.7 L/s (3.5 US pint/s). The whale shark is an active feeder and targets concentrations of plankton or fish by olfactory cues rather than simply 'vacuuming' constantly. Whale sharks congregate at reefs off the Belizean Caribbean coast, supplementing their ordinary diet by feeding on the roe of giant cubera snappers, which spawn in these waters between the full and quarter moons of May, June, and July.
The whale shark does not need to swim forward when feeding; it is often observed in a vertical position, 'bobbing' up and down swallowing water and actively filtering it for food.
http://en.wikipedia.org/wiki/Whale_shark