A library is a bundle of code which other programs can use. For example, if a program wanted to open a JPEG image file, it might ask a library to convert it to a format it understands, rather than write new code to decode JPEGs.
Libraries are normally shared throughout your computer. Normally the library is only loaded into memory once, so if you're running two programs from the same library, you will save memory.
Using libraries has many other advantages. If changes need to be made to some code in a library, you can just update the library file and all the programs will be updated.