Nginx is the open-source server app (its source code is here) that you can install and run on your own server. It is specifically optimized to serve static content from your server like images or static files (i.e. not rendered by some code). Usually, the developer setting it up to run before a dynamic web server so it can serve static files first. Thanks to its speed and low memory consumption, it is extensively used by high-load applications like Facebook and many others (including adult websites). While the Nginx server works faster than other static servers but it does not mean it can work without CPU, RAM, or hard-drive space at all. The common scenario ten years ago was that if you are running a web application or a website it means you should run and manage your own server (for example, to run a WordPress-based website). And one of the first steps for optimizing the server was to install and run a so-called “reverse” proxy. This “reverse” proxy is usually based on an Nginx server to serve static files like images, CSS, JS, PDF from your server with max speed. That was the popular way to optimize the speed and performance of websites before CDN came into the game.
Then CDN services got their foot in the door. For example, Amazon AWS CloudFront (as well as CloudFare and others) is the scalable content delivery network (CDN) that can cache static files from your server and deliver them faster. It also uses dozens of servers worldwide in all continents so your files are actually downloaded from the very nearest server and served faster to a user who requested this file.
For example, your website runs on hosting in the United States but you want to have your video files to download as fast as possible from both San Francisco and Mumbai.
Other popular CDN Services and AWS Cloudfront alternatives worth checking: