I hear a lot of people talk about how "new" linguistics is, or how "small" it is compared to other fields. Pāṇini studied grammar in the 4th century BC. Surely it didn't take until recent history to study it scientifically?
This is a great question. Not that it matters all that much, but it's always good to periodically revisit the directions one's discipline has taken.
First, the problem is that there's linguistics and then there's study of aspects of language for a particular purpose.
Lexicography, pedagogic grammar, philosophy of language - they all have a long tradition in the West. You could almost say that applied linguistics came first.
One of the earliest significant works of linguistic theory was the Port Royal grammar of 1660 but it can in no way be seen as even a pre-cursor of modern linguistics. Its importance was retrospectively recognised by Chomsky but it had almost no direct influence on the development of the discipline.
The true starting point of linguistics as a separate discipline is generally identified in the work of William Jones (more than 100 years after the Port Royal grammar). Jones recognized commonalities between several Indo-European languages and thus started what is still recognizable as modern philology. From him, we can trace the developments of the following century almost in a direct line.
It would be another 100 years before we could point to something that looks like truly modern linguistics. By this I mean, an empirical research paradigm aimed at discovering the principles behind the workings of individual languages, their building blocks and language as a general phenomenon. Some names that stand out along the way are Wilhelm von Humboldt and Hermann Paul but it's not until the work of people like Otto Jespersen, Ferdinand de Saussure, Jan Baudouin de Courtenay and Vilém Mathesius at the start of the 20th century that we get output that we can read and still find linguistic affinities with (note: philologists can go all the way to Jones). de Saussure is by far the most famous but mostly through the efforts of his students. The competence/performance dichotomy can be directly traced to him (Chomsky's inventing history by pointing to the Port Royal grammar as his true antecedent. It was really the structuralists.) And, of course, it is only slightly later that Edward Sapir and Leonard Bloomfield contributed their significant syntheses that echo in the work of linguists to this day.
We should also not neglect the developments in affiliated disciplines which have been developing along side (if often slightly behind) general linguistics. Phonetics and phonology, psycholinguistics, and even philosophy of language each have their own interesting histories and intertwining but separate interests from those of linguistics. Then there are those of subdisciplines like sociolinguistics, contact linguistics, discourse analysis, corpus linguistics, etc. which each also have trajectories that are worth pursuing most of them not really starting until the 1950s. In many people's mind, linguistics is identified with generative linguistics but that is only one of the many subdisciplines of the field whose importance was artificially inflated at least in part due to US defense funding of AI research (see Frederick Newmeyer's histories on this).
Sadly Pāṇini's is always only mentioned as a footnote. Yet, his influence on all the Sanskrit scholars must have been significant. When you compare his meticulous treatment of Sanskrit grammar (including phonology) from at least 400 BCE with the meager output of European grammarians since the days of Plato, you cannot be in awe. Arguably the work of Indian grammarians provided models of best empirical practice for European students of Indo European languages but it is hard to estimate exactly what impact it's had on linguistics as we know it today. But it is without question the greatest work of empirical and theoretical linguistic inquiry prior to about the mid 1800s.
Finally, let's talk about the question of "scientific" study of language. Chomsky and his followers often cover up their embarrassing ignorance of the vast field of linguistics by dismissing anybody not in their formalist tradition as somehow not scientific enough. Whatever you think about Chomsky's own theory (and I think it is an impressive achievement if not really that much about the empirical phenomenon most people would describe as language), this is just pure and unadulterated nonsense. It's a rhetorical rather than an empirical device that is unfortunately all too common in academic discourse. But it is no less disreputable by its ubiquity.
Post Script: Many alternative perspectives could be offered on this subject. I have certainly focused on the work with which I am most familiar and to which I feel a great affinity. However, I suspect that for all its biases, that mine is fairly mainstream perspective on the history of linguistics. I would accept quibbles and corrections on almost every particular but the overall trajectory would probably remain the same. I wrote this from memory (relying on Wikipedia to check the spellings of names) influenced as much by my reading of the source materials as histories of linguistics I read and classes in the history of linguistics I took about 20 years ago. I spend a lot of time trying to find connections between old and new understandings of language but mostly in a rather unsystematic manner, so I took this opportunity to summarize some of my mental notes.
Modern syntax was first put on a scientific basis by Zelig Harris and Noam Chomsky: Harris with his development of formal models of phrase structure and Chomsky through his elaboration of Harris' techniques, by his clarifying the distinction between empirical study of syntax and language pedagogy, and by devising the first formalized model of the traditional idea that many language constructions involve movement of sentence parts to new positions. That last was, of course, transformational grammar.
In an historical account of our discipline, Pāṇini of course deserves a prominent role, but his grammar can't be accounted as right or wrong, except on accuracy of factual claims, because it is all about pedagogy. It gives a method for reciting the scriptures without error. While Chomsky made the crucial point that a scientific account needs to make predictions about expressions that are never problematic for human language learners.
I do not mean to imply that Chomsky's theories have been correct theories. As a matter of fact, I think that transformational grammar has been shown to be wrong. But this is a characteristic of scientific theories -- they can be shown to be wrong. It is confused to disparage Chomsky's place in developing modern linguistics because you happen not to be a follower of TG, or minimalism, or whatever Chomsky's very latest ideas are. The great thing about TG is that you can tell whether it's wrong. (It is, as Ross and others showed.)
The simple answer is that the field of linguistics as it is understood today begins in the 20th century, with deep roots in prior study of language. The practice of asking questions about language and how it works is much more ancient, as is the practice of asking questions about the mind and how it works and develops, but it is not until the 20th century that we start to see a systematic approach that links those questions, which in my view is what marks linguistics as a discipline today.
By way of analogy, the field of chemistry can be said to start in approximately the late eighteenth century. The practice of asking questions about the internal structure of matter or the interactions of different sorts of matter goes back much further, through alchemy and various informal knowledge systems (Roman concrete, for example) back to the Greek speculations, and so forth, but it is not until it the questions of internal structure and interactions become linked that modern chemistry begins.