What is an OGG file? Media files generally have two separable aspects, and OGG follows this pattern. A file consists of a container that holds data with a particular encoding.
The container is the file's scaffolding. It includes a header, metadata, and a way to hold the encoded content. A container isn't limited to one encoding, though some pairings are so common they're expected.
The encoding is the way the audio or video is represented in bits. Sometimes you'll find encoded data without a container; for instance, MP3 files don't use a container except for an optional metadata block.
Encodings may be lossless or lossy. Lossless encodings represent the original analog signal at the full sampling rate and bit depth. Lossy ones eliminate low-order bits, using techniques that minimize the loss of quality. The advantage of lossy encodings is that the files are smaller.
The software that converts between analog signals and digital encodings is called a codec (coder-decoder).
OGG is a container format developed by the Xiph.Org foundation. The project dates back to 1993. It got going seriously when Fraunhofer announced it would charge license fees on all MP3 software. The aim was to create a media format that had a public specification which anyone could implement free of charge. Because of its open and widely supported nature, many options are now available for how to play .ogg files.
In principle, the OGG container can be used with many different encodings. You could have an OGG MP3 file, though no one ever does. If you have trouble playing an OGG file, it may be because it has an unusual encoding.
Generally, the container is used with encodings that are primarily intended for it. The two most important ones are Vorbis for audio and Theora for video.
Theora hasn't been supported for years. When people talk about the OGG file type, they mean OGG Vorbis unless they say otherwise. The extension for OGG Vorbis files can be either .ogg or .oga. OGG video files use the extension .ogv. If you have OGG Theora files, you should consider converting them before they become unusable.
The name "OGG Vorbis" will sound very familiar to fans of Terry Pratchett's Discworld novels. Vorbis is named after the villain in Pratchett's Small Gods. However, Xiph.Org insists that OGG isn't named after the witch Nanny OGG, who appears in many of the novels. It comes from an obscure jargon term.