Suppose you have an E-commerce cloud having various Microservices as shopping cart service, Order service, Inventory service and so on. You need to have an API gateway as an Edge service to the outer world.
The API gateway abstracts the details(host & port) about the underline Microservices. Now, all your clients just need to know one server URL which is your API gateway. Any changes in any other Miroservice would not require any changes in your client app. Whenever an API gateway gets a request, it routes the request to a specific Microservice.