I'm very interested to know how coordinate systems were discovered and why mathematicians discovered them? Actually I want to know what things motivated mathematicians to discover and develop coordinate geometry or analytic geometry. What problems they faced in the past for which they felt the need for discovery and development of coordinate system?
The earliest coordinate systems appear in astronomy and geography. I think it is completely clear why they were necessary. As fdb noticed Eratosthenes and Hipparchus already used them but they must have been used much earlier. Indeed, Hipparchus discovered precession of equinoxes. How can this be done? One has to compare the star coordinates that you measure with the same stars coordinates measured many years earlier. So there is no doubt that there exited some star catalog before Hipparchus. (Somewhere I've seen the statement that Eudoxus made one. Neither Hipparchus catalog nor the earlier one survived to our days, but there is no doubt that they existed). The person who made the first star catalog must have used some coordinate system.
The accuracy of measurement available at Hipparchus time was not sufficient to discover precession from observations spanned over one life time.
EDIT 1. According to Wikipedia, the earliest known star catalog that lists stars with their coordinates was the one by Timocharsis (320-260 bc). This catalog was used by Hipparchus to discover the precession.
EDIT 2. In pure mathematics, it is of course credited to Descartes. One of the motivations he apparently had was to simplify the ancient theory of conic sections. Ancient theory of conic sections is known from the books of Apollonius, and this is really a hard reading, even today:-) Descartes was apparently the first to notice that these conic sections can be defined by simple quadratic equations which simplifies the theory so much that it can be even taught to undergraduates nowadays. Source: M. Berger, Geometry revealed, Springer 2010.
The coordinate system, as we know it now, was developed by Descartes. However, a system of spherical coordinates to measure longitude and latitude goes back at least to Eratosthenes and Hipparchus.