I know that an API is called a set of functions used to call something, and a library is a collection of classes, but what is actually API in package like java.lang
API is a logical representation of non-empty collection of Java classes and interfaces (add annotations and enums).
Library (being JAR Java library) is a unit of deployment of one, many or part of API.
There is no one-to-one or many-to-one association between two in general since their concerns are orthogonal in nature: API is concerned with logic and functionality; library is concerned with deployment.
Excellent resource that covers these relationships is Robert Martin Principles of OOD - look for last 6 package principles.