A couple things here. I've looked into this before, and a lot of the information you find online is of ... let's just say, varying quality, and doesn't critically look at primary sources. A lot of the references to plague doctors outfits come from periods well after they were actually used. So during the Black Death, the most famous outbreak of bubonic plague in Europe and Asian, doctors almost certainly didn't wear masks with beaks. This is an anachronism -- the first description of the "plague doctor" comes from the 17th century, and many of the prints that we have are 18th century re-interpretations (Wellcome has a great collection: https://wellcomecollection.org/works?query=plague+doctor). It's not actually clear how widespread the beak design actually was. If you can read French well, Jean-Jacques Manget provides the classic description from pp322- 323. (https://books.google.co.uk/books?id=f68UAAAAQAAJ&pg=PP3#v=onepage&q&f=false). He is writing from the perspective of the plague doctor being something from the past.
So first of all, I apologize for my poor French. But Manget actually answers your question in this passage -- the beak contains "perfumes" to counter the pestilential odors, which he dates back to Hippocrates. This is the theory of miasma, that disease is caused by bad air (and in particular, bad odors). Strong smelling perfumes would presumably counter this and provide some degree of protection.
The older prints that you can see on Wellcome also don't have such a bird-like design. That comes from the "Plague Doctor" Venetian carnival mask, which is why I think the plague doctor looms so large in the public consciousness.