Thanks for A2A.
A library is a set of code that was previously written, that can be called upon when building your own code. It is work that was previously done by someone else that you can now make use of, without having to do it yourself. And you can make use of it in your own code, legally, as it was written to be used by others. Now different libraries will have different restrictions on fair use, but this was code what wasn't designed to just stand alone, but to be used in someone else's code.
Davor Lozic gives good examples for C language, and good explanation of static and dynamic libraries, to which I'd add that dynamic libraries can often be updated without updating your code. And example you'll see of this often is how programs will change the way they present a file..open menu to you when you upgrade your operating system. In that case a dynamic library was changed underneath the program, and now the programs will look like they changed, when they didn't.
C++ also has a standard library. Most languages have libraries, but for some they come under different names, such as packages under java, which are conceptually the same as libraries, but with enforced naming conventions (namespaces) that are working to insure no accidental cases of different libraries using the same name.
Most software based projects will gain very complicated capabilities by just purchasing an off-the-shelf library and working with it, without having to do all the work themselves.