Both exist. Nix is a functional language for describing how software is built. Nix is also a package manager of sorts that installs and manages software built with its language. NixOS is an operating system that is described entirely by a nix language configuration file that builds a bootable linux-based OS using nix language packages.
Nix is a package manager & programming language that you can install on any Linux or MacOS to manage software.
NixOS is a bootable OS build on top of Nix.
Nixpkgs is the default package collection used by both Nix and NixOS.