The Royal Library of Alexandria was founded by Ptolomy II Soter, It formed part of the Museum which was located in the Bruchion or palace quarter of the city of Alexandria. This great ancient city, occupying a spit of land on the shore of the Mediterranean Sea, had been founded by Alexander the Great in his flying visit to Egypt and became the capital of the last dynasty of Pharaohs descended from Alexander's general Ptolemy. The Great or more properly Royal Library formed a part of the Museum but whether or not it was a separate building is unclear.
Alexandria was the publishing capital of the planet. Of course, there were no printing presses then. Books were expensive; every one of them was copied by hand. The Library was the repository of the most accurate copies in the world. The art of critical editing was invented there. The Old Testament comes down to us mainly from the Greek translations made in the Alexandrian Library. The Ptolemys devoted much of their enormous wealth to the acquisition of every Greek book, as well as works from Africa, Persia, India, Israel and other parts of the world. Ptolemy III Euergetes wished to borrow from Athens the original manuscripts or official state copies of the great ancient tragedies of Sophocles, Aeschylus and Euripides. To the Athenians, these were a kind of cultural patrimony -- something like the original handwritten copies and first folios of Shakespeare might be in England. They were reluctant to let the manuscripts out of their hands even for a moment Only after Ptolemy guaranteed their return with an enormous cash deposit did they agree to lend the plays. But Ptolemy valued those scrolls more than gold or silver. He forfeited the deposit gladly and enshrined, as well he might, the originals in the Library. The outraged Athenians had to content themselves with the copies that Ptolemy, only a little shamefacedly, presented to them. Rarely has a state so avidly supported the pursuit of knowledge.
Link- Library of Alexandria