
"Early gun lubricants were mostly used to protect metal, and to lubricate bullets. Gun mechanisms just didn't have high lubrication demands yet. But you got to use bear grease, and that's always a plus."
~Cherry
Educate yourself - A History of Firearms Lubricants

Early gun lubricants were used more to protect metal from the elements and for bullet-patch lubrication than mechanical lubrication.
Understanding historical gun lubricants is a matter of knowing both what was available, and what those lubricants needed to accomplish. For the modern shooter, perhaps the biggest thing to keep in mind when digging into this past is that the lubrication demands of more modern self-loading designs are far more intense and consequential than those of what we loosely term here as "human-powered actions", such as lever-actions, pump guns, and revolvers. Lubricants used in the past not only had different uses, in most cases until just before World War I, gun 'lubricants' also had minimal demands placed on them in lubricating locks and actions, being mainly used for other purposes.
Muzzleloading firearms, dating from the earliest matchlock muskets of the 1400s until being eclipsed by cartridge firearms in the 1860s, used lubricants primarily for two purposes: protecting metal surfaces from rust, and in lubricating the cloth patches that were used around the lead roundball bullet to achieve a tighter seal in the barrel, for enhanced accuracy. Most patched roundball use was seen in rifled firearms, or civilians using smoothbore 'Trade Guns' or fowling pieces as an all-around hunting and survival firearm - situations where accuracy was more important than volume of fire. The linear warfare tactics of the era, however, required soldiers to load their weapons without patches, prioritizing rate-of-fire over accuracy. While the vast majority of lubrication used on modern guns is applied to mechanical actions, for muzzleloaders, rust prevention and patch lubrication consumed far more lubricant than was ever remotely required to keep their locks working.
During the muzzleloading period, the two most common types of lubricants seen were 'Sweet Oil', which was olive oil (large quantities of which were imported into North America), and various types of rendered animal fats, with 'bear grease' and deer tallow (rendered 'suet' fat from the kidney area) often considered the most effective in general. To protect metal surfaces, some military units were advised to wipe their weapon surfaces down with fresh, unsalted pork fat as an anti-rust protectant, as the grease-like fat stayed put more effectively than oil, repelling moisture well.
Various tallows in general have been used on firearms for centuries. It tended to stay 'wet' and stayed where you put it much longer than alternative oils, acting in that respect much more like a grease. Its longevity and ability to stay put also made it ideal for lubricating mid 19th-century 'Minie' ball projectiles, which dropped down into a barrel

Paper Enfield cartridges, one end holding a tallow-lubricated bullet, the other the powder charge.
without patch, relying instead on forming a seal against the rifling when their hollow base expanded as the charge ignited. Tallow, unfortunately, also served as a key spark for a major uprising in 1857 against the British in India, as both beef and pork tallow

Statue of Rani Lakshmibai and her child, escaping British forces during an uprising sparked in part by gun lubricants.
were used to lubricate the Minie balls of the 1853 Pattern Enfield rifle. The paper cartridges, which in effect were more like speed-loaders, contained a pre-measured powder charge, as well as the bullet. To load the weapon, soldiers were to bite into the paper (also accused of being made with pork or beef tallow) to open up the cartridge, so that they could pour the powder into the barrel. However, roughly 300,000 soldiers of the British East India Company were local Hindus and Muslims. Whether for spiritual fears of being on the receiving end of pork or beef tallow-lubricated bullets, or out of fears of 'losing caste' or becoming defiled by biting into a paper cartridge using beef or pork products, both the local soldiers of the British East India Company and the civilian populace were incensed by it. The rebellion, partly led by an Indian warrior queen, Rani Lakshmibai, has been estimated to have cost between 100,000 lives and up to 10 million, and is considered India's first war of independence.
With the advent of cap-and-ball revolvers, and especially with the emergence of black-powder metallic cartridges, a revolution in the mechanical systems of firearms occurred quite rapidly. Actions became much more complicated, and in many cases had finer tolerances. The complexity of these actions resulted in the mechanical parts having more friction surface overall, and more opportunity for friction contaminant to work its damage, all allowing for more opportunity for malfunction. Additionally, the much higher rate of fire on the newer guns allowed their actions to be exposed to more fouling and friction contaminant in hours of use than a flintlock musket's spring and sear internals would be exposed to even after days of combat. Consequently, the cheap, tried-and-true, readily available olive oil and bear grease just didn't meet most of the lubrication requirements of these newer repeating actions.
What did, however, was an incredibly effective lubricant used by watchmakers for over a century at that point: Sperm Whale oil.

The Colt Paterson, mfg 1836 - the first commercial revolver with single-barrel and revolving cylinder. Repeating mechanisms increased lubricant demands.