Smaller Joomla installations commonly store a web server and a database on the same machine. The web server itself will manage the important services such as PHP. It will also provide the end user with the HTML necessary to display a web page.
In large systems, especially in the Enterprise world, it is common to have the database on its own machine. The database stores information about users, articles and module settings and content. Storing information in a server this way allows Joomla to provide a truly dynamic web experience to users, showing only the information that each visitor requests.
For a look at how Joomla functions, visit our free Joomla tutorial course - The Basics.