Synthetic indigo was discovered by a chemist..

 .. who was trying to synthesize the medicine quinine to treat malaria.  18 year old chemistry student William Perkins made a murky residue which was the first aniline (synthetic) dye.  It was called mauve, and it was consistent and permanent, unlike natural dyes.

(Photo: the first aniline synthetic dye – mauve)