COIMBRA, Portugal—During the day, as visitors file through the University of Coimbra’s 300-year-old Joanina Library, the creatures remain hidden behind the grand, gilded bookcases.

At night, they come out to protect the books.

They are a group of perhaps a dozen resident bats. As lovers of literal bookworms—they eat the moths and beetles that...