Astronomical observations have shown that carbonaceous compounds in the gas and solid state, refractory and icy are ubiquitous in our and distant galaxies. Interstellar molecular clouds and circumstellar envelopes are factories of complex molecular synthesis. A surprisingly large number of molecules that are used in contemporary biochemistry on Earth are found in the interstellar medium, planetary atmospheres and surfaces, comets, asteroids and meteorites, and interplanetary dust particles. In this article we review the current knowledge of abundant organic material in different space environments and investigate the connection between presolar and solar system material, based on observations of interstellar dust and gas, cometary volatiles, simulation experiments, and the analysis of extraterrestrial matter. Current challenges in astrochemistry are discussed and future research directions are proposed.