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
The API (Application Programming Interface) is what a library looks like from the outside for a program that's using it. It's the "face" of a library to other programs. The API of a library is the set of publicly accessible classes, interfaces and methods in the library.
You wrote:
I can connect to a class like System without using any API here...
That's not true - class System is a public class in Java's standard library, so it's part of the API of the standard Java library. You are using the API of the standard Java library if you are using class System.
Why do you think you "are not using any API" when you use class System?