There are different types of apps and where they are stored is based on there type.
Check this figure out,

Source - 1
If an app contains SharePoint components, those components are stored
in a subweb of the site that is automatically created when you install
the app. Apps have their own, isolated URLs, which are separate from
the URL for the site that contains the app. If the app is a
Provider-hosted or Windows Azure autohosted app, the app components
are stored in those locations. For example, in the following diagram,
App1 contains custom business logic and is stored on an external
server - it is an Windows Azure autohosted app and does not store
content in a subweb of the site. App2 is a SharePoint hosted app with
only SharePoint components. App2's content is stored in a subweb of
the site on which it is installed.
Source 2

where are they stored? Are they stored in content database where the
app is installed?
If its SharePoint hosted then all of apps will be stored in app catalog, which is just a document library, therefore will reside in content db.
How to: Set up an app catalog on SharePoint
Edit for Comment
Other than these UI elements, the app for SharePoint components and
content, such as lists, content types, workflows, and pages, are
deployed to a different website in a special isolated domain. This
fact is largely hidden from the user. The special website to which the
app is deployed is called an app web. The website to which the app is
installed is called the host web. Although the app web has its own
isolated domain, it is in the same site collection as the host web.
(One exception to this rule is when the app is installed with tenant
scope. In that scenario, the app web is in the site collection of the
corporate app catalog.)
Host webs, app webs, and the isolated domain
Content type, lists and other components are kept in app web which is a isolated domain in same site collection where you installed your SharePoint app. Now if you want to dig deep then these contents are stored in Content Database in which your site collection (web application) is attached to.