A video container is a wrapper file format that holds streams of encoded video, audio, and metadata. The codec is the algorithm used to compress those streams. When you convert a video, you may be changing the container, the codec, or both.
For example, converting MKV to MP4 with H.264 video may only require a remux (moving data between containers without re-encoding) if the source already uses H.264. This is near-instant and lossless. Converting MP4/H.264 to WebM/VP9, however, requires full re-encoding and takes longer.