Plants make molecules that have aromas for several reasons. Some of the molecules are used by the plant to attract insects for pollination. Other molecules are there to repel insects that might otherwise dine on the plant.
Sometimes a plant has an odor simply because some of the molecules in it are volatile, and make their way through the air to our noses. Pine scents contain many light molecules that float through the air easily. Some of these are insecticide molecules, and our noses are pretty good at detecting molecules that might be toxic.
The smell of freshly cut grass is due in part to molecules the pant gives off when under attack by insects. These “green leaf volatiles” attract predatory insects that eat the bugs that are eating the grass. In order to do their job, they have to travel through the air, and land on the scent-detecting cells on the antennae of the predatory bugs. But we can smell them too.
Some of the molecules in cut grass are antimicrobials, and they are part of the plant’s reaction to injury. They are there to kill bacteria and fungus. Our noses are sensitive to molecules that are active enough to kill germs.