Can I run an API gateway on the same instance as my API?
It should be fine to run the API Gateway on the same server as API-apps - for smaller setups. For larger setups when you need more servers may make sense to use dedicated nodes for API Gateways. API Gateways are increasingly playing a dual role as an application load balancer, or Level 7 Proxy for your APIs - those have a specific role when it comes to network addresses and routing, this is the main reason to why it makes sense to use dedicated servers for this part of your stack.

why an API gateway should be on a separate server to the API?

what is more important for this part of the stack is that you would like to avoid single-point-of-failure, so you should use more than one instance for API Gateways, and also for the API apps. When using multiple instances, it is often easier to separate the load balancer/Gateway from your app workload due to the specific needs for network addresses for the gateway, but in the end this depends on how your whole architecture looks.