Originally this was something which served as an organ and with time was adopted by chemists to refer to carbon based compounds. As a result of living things being carbon based it extended to which living things and material which resulted from living things; hence organic matter.
The latter half of the 20th century saw the word adopted by the anti-chemical movement to mean something produced without the use of manmade chemicals.