You are specifying which library, if you say "go to a library" you can go to whatever library you want, if you say " go to the library", that means that there is a library that both the speaker and the listener know about and mean. for example the school library.