The discipline of analytic geometry is traditionally supposed to have originated with the work of René Descartes, hence its name of Cartesian geometry.
There exists a story that he first invented it while watching a fly crawling across the ceiling while he was lying in bed in the morning.
However, it appears that Descartes may in fact have obtained his key ideas from Nicole Oresme's Tractatus de configurationibus qualitatum et motuum.
It is also worth pointing out that Pierre de Fermat had the same idea at the same time as Descartes, independently of him, and, according to some sources, did considerably more with it.
Be that as it may, Descartes and Fermat corresponded with each other on the subject, so it may be accurate to suggest that there was considerable overlap between them.