It is only possible for home cooks to make sour cream with unpasteurized cream, which is virtually unavailable these days. In earlier times, of course, sour cream made itself as the bacteria present in the cream soured and thickened it.
Nowadays, homogenized, pasteurized cream is inoculated with certain bacteria, kept warm while the bacteria do their work, and then repasteurized to stop the souring process.
Because commercially produced sour cream it is “dead” when sold, it has a pretty good shelf life. You can keep sour cream for one to two weeks after the sell-by date stamped on the container, but we’re sure we’ve kept edible sour cream around longer than that. The presence of mold or a pink discoloration tells you that it’s time to move on to a new container.