Plants have evolved to respond to critical changes in the environment by either growing their roots, or leaves towards/away from any stimulus. This response, is called a tropism.
For example, The plant's stem and leaves bend toward sunlight. Their roots grow toward Earth's gravity.
Plants have complicated systems to detect and then respond to changes in light, gravity, temperature, and or even physical touch.
I hope this helps!