Where does calibre keep your books, and what are metadata.db and metadata.opf?
calibre keeps your books in its library folder, the one it asked you to choose the first time it ran. Each book you add is copied there, into a folder for the author and, inside it, a folder for the title. metadata.db sits at the top of that library folder and is the database that holds the titles, authors, tags and everything else calibre shows in its book list. metadata.opf is a smaller file in each book's own folder: a backup of that one book's details, which calibre writes so that the database can be rebuilt if it's ever lost.
Finding the folder
The calibre FAQ doesn't give one fixed path, because you pick it yourself. To see where yours is, click the calibre icon in the toolbar and choose Switch/create library: the dialog shows the path of the current library. If you have more than one library, each is a separate folder with its own metadata.db.
Inside, the layout is Author, then Title, then the book files. The title folders end in a number, and the FAQ explains it: that number is the ID of the book's record in calibre's database. It lets two books with the same title and the same author live side by side, and it helps when the database has to be regenerated. The FAQ is firm that calibre won't let you store books in a folder structure of your own, though Save to disk will export copies into one you choose.
It's also firm about the folder itself. calibre manages its contents, and the FAQ asks you not to add files or folders to it by hand, because they may be deleted automatically. The originals you added from elsewhere are left alone: the user guide says calibre works on copies of the files you give it.
metadata.db
metadata.db is an SQLite database, and it is the library as calibre sees it. The FAQ says the book list is built by reading this file. If the list ever comes up blank, the two causes it gives are a library folder that has moved (a drive letter changed, for example), so calibre is looking in the wrong place, or a metadata.db that has been deleted or damaged.
Your custom columns and saved searches live in the library too: the FAQ's advice on backups says that a copy of the library folder carries them along with the books and their metadata.
metadata.opf
OPF is an XML format for a book's metadata (calibredb show_metadata --as-opf prints a book's details in it). The user guide calls a corrupted metadata.db “a very rare event”, but says calibre backs up the metadata of every book in that book's folder as an OPF file all the same. The calibredb reference adds that the OPF files are updated automatically each time the metadata changes, and its data_files command names the one in each book's folder that it won't touch: metadata.opf.
You don't need to open these files. They matter on the day metadata.db fails: right-click the calibre icon in the toolbar and choose Library maintenance › Restore database, which rebuilds the database from them. The command line has the same step as calibredb restore_database, which runs only with --really-do-it, and its warning is worth reading first. The rebuild regenerates the database completely, so saved searches, user categories, plugboards, stored per-book conversion settings and custom recipes are lost, and the restored metadata is only as accurate as the OPF files were.
If you think the OPF files are behind, calibredb backup_metadata writes the out of date ones again, and --all rewrites every book's.
Moving or backing it up
The library folder is the unit to copy. The FAQ says to back up the whole folder, with all its files and subfolders: the database and the book folders go together.
To move to another computer, the FAQ points to Export/import all calibre data, which you find by right-clicking the calibre icon, and keeps copying the folder by hand as the fallback. Switch/create library can also move the current library to a new location. One warning from the FAQ: don't put the library on a networked drive, and don't put it in Google Drive, which it says is incompatible with calibre.
Leaving calibre for another app works the same way, from the folder. Readwyn's import asks for the folder that has metadata.db in it, opens the database read-only for a one-time import, and copies the books out without changing anything in the calibre folder (what it brings across). If you've found calibre files on your e-reader instead, those are different ones: metadata.calibre and driveinfo.calibre.