I'm super curious about this one because I guess it seems really random to me! Also, I would love to know why we use them for funerals and such as well
Giving flowers for the dead is probably one of the oldest human customs--while I can't speak as to whether it's universal, evidence of flowers buried with the dead goes back 60,000 years.
http://www.smithsonianmag.com/arts-culture/the-skeletons-of-shanidar-cave-7028477/?no-ist
Ancient Egyptians, Romans, and Chinese all viewed flowers as culturally significant, as numerous references and symbols based on flowers appear in art and literature.
Today, a lot of the Western customs we have around flower giving come from the Victorian era. Back then, a whole system of meaning could be imparted through flowers.
http://extension.psu.edu/plants/master-gardener/counties/adams/news/2012/the-joy-of-giving-flowers
While there isn't anything so rigorous today, some parts of the world have strict customs around giving flowers. For example, in Slavic countries (Russia/East Europe), you only give even numbers of flowers in the event of a funeral/lying flowers on a grave. Giving a dozen roses to your sweetheart or mother is rather insulting! Odd numbers of flowers are for gifts, etc.