We review the formation and evolution of complex circumstellar and interstellar molecules. A number of promising chemical routes are discussed which may lead to the formation of polycyclic aromatic hydrocarbon molecules, fullerenes, and unsaturated hydrocarbon chains in the outflows from stars. Some of the problems with these chemical schemes are pointed out as well. We also review the role of grains in the formation of complex molecules in interstellar molecular clouds. This starts with the formation of simple molecules in an ice grain mantle. UV photolysis and/or thermal polymerization can convert some of these simple molecules into more complex polymeric structures. Some of these species may be released to the gas phase, particularly in the warm regions around newly formed stars. Methanol and formaldehyde seem to play an important role in this drive towards molecular complexity and their chemistry is traced in some detail.