I believe that pets are a modern concept, so interactions with wild parrots might not be enough for them to learn how to repeat people. However, I was still wondering if there is any records of people discovering that those funky birds can talk.
This is a very interesting question! The short answer is that people have known about the parrot's ability to mimic human speech for thousands of years, and as far as I'm aware there's no record of the first person to discover this fact. Like many of our earliest experiments with domestication/taming, it probably first occured in prehistory.
In Europe, the earliest written references to parrots date to the fifth and fourth centuries BC. Ctesias mentions in Indica the parrot's 'human tongue and voice' and states that 'it speaks Indian like a human being and Greek if it is taught Greek'. Aristotle, writing several decades after Ctesias in the Historia Animalium, says that 'the Indian bird, the parrot, which is said to have a man's tongue, [is disposed to mimicry]; and, by the way, after drinking wine, the parrot becomes more saucy than ever'. According to Bruce Boehrer, Alexander the Great first introduced parrots to Greek culture around this time after finding them on his expeditions to India - evidently, Indians had already known about the bird's capacity for mimicry, if Ctesias' statement about them speaking 'Indian' is anything to go by.
From this point onwards, their ability to 'speak' was common knowledge in Europe throughout antiquity and the Middle Ages, and was part of the reason for the trade in parrots between Asia and Europe - they were often kept as pets in noble households and menageries. I don't know anything about what ancient and medieval Asian authors had to say about parrots, and whether there's any relevant texts from this region which mention them that predated Ctesias - if anyone who has experience in this area would like to jump in here, I would be very grateful!
Also - this is a tangent, but in your post you mention that you think pets are a modern concept. This is an issue that's been a source of debate in historical studies of animals. In my own field of expertise (the European Middle Ages), there are some scholars such as Kathleen Walker-Meikle who argue that medieval people did have a level of emotional connection and affection towards companion animals such as cats and dogs that isn't much different to that of people in the modern West (although she points out that 'pet' as a category of animal doesn't exist during this period). It's a matter of your own interpretation as to how far you want to accept that, though.
Sources:
Bruce Boehrer, Parrot Culture: Our 2500-Year-Long Fascination with the World's Most Talkative Bird (2010)
J. M. Bigwood, 'Ctesias' Parrot', The Classical Quarterly 43, no.1 (1993): pp. 321-327
Kathleen Walker-Meikle, Medieval Pets (2016)
Aristotle, History of Animals, trans. D'Arcy Wentworth Thompson (1910)