The garlands are used to wish someone good luck and are also used during paying respect at a wat (temple). You’ll will also find many of them placed in front of Buddha statues around the streets of Thailand.
For the many times I have been stuck in traffic there always seems to be someone selling so I go ahead and buy. Not for the reasons that the Thai’s do but simply because I love the smell it leaves in the car and in my house. I also think they are very pretty.