
Why do different plants have different flavors? For example, why does a tomato taste different from celery?

The flavor of a plant is determined by a variety of factors, including taste, smell, texture, and temperature. The “taste” of a plant is determined by its chemical makeup. There are five tastes sensed by the gustatory receptors in our tongue: salty, sour, sweet, bitter, and umami (evoked by, among other things, amino acids such as monosodium glutamate). In addition, our taste receptors can also distinguish among the different concentrations of the five tastes. Thus, a strawberry, which has a large concentration of sugars, tastes sweet, and a lemon, with a high concentration of compounds that activate the sour receptors, tastes tart.
Our sense of smell actually plays the most important role in determining the flavor of a plant. In contrast to our taste receptors, there are hundreds of different odorant receptors that can discriminate among thousands of different chemical odors. Chemicals can diffuse directly to your nose from within your mouth through your nasal passages. So, although both a strawberry and an orange may be sweet, they both have a distinctive chemical odor (for the orange, caused by octyl acetate) that is perceived in our brain via our olfactory receptors.
Lastly, there are various other factors that influence flavor, including texture, temperature, pain (such as spicy foods), and color. Plants are especially likely to depend on these additional factors because of the diversity of colors and textures of all the different plants found in nature.
In the example you presented contrasting a tomato with celery, the flavor will be determined by the taste of the more acidic and sugary tomato compared with the celery. However, texture probably makes a large contribution as well, since the tomato has a completely different texture in your mouth than the celery does.
More information
http://www.cf.ac.uk/biosi/staff/jacob/teaching/sensory/taste.html
http://users.rcn.com/jkimball.ma.ultranet/BiologyPages/O/Olfaction.html