Databases allow for the storage of structured information in a way that is easy to retrieve. Every app you use is powered by databases. Think of them like spreadsheets optimized for billions of operations.
An API is made for applications to interact with a program programmatically. In other words, an API interfaces with another program and the interaction is done with code. The API delivers the outputs to other programs so they can do their own operations with them.