The API gateway is a service that's responsible for routing requests from clients to applications, and is very similar to a design pattern called facade, from object-oriented design, which is best described in the book Java EE 8 Design Patterns and Best Practices.
The API gateway encapsulates logic to call the proper backend services. As it is the single entry point, it can also have other capabilities such as securing services, transforming payloads, monitoring, throttling, caching, and rating the number of requests per service, and so on. The API gateway is also responsible for exposing services with different protocols.
Another scenario in which it can be used is to call multiple services, aggregate the result, and return the proper output (API composition implementation) as shown in the following diagram: