Damage Reduction, is a game mechanic popularized by Dungeons & Dragons, although it wasn't formally named as such until 3e. As the name probably indicates, Damage Reduction is a way of handling the various supernatural or logical toughness-related advantages that different creatures may have, resulting in a reduction of damage inflicted, unless the damage was caused by something specifically useful for hurting that creature.
The two most classic examples are skeletons being resistant to non-bludgeoning physical damage (but taking bonus damage from blunt hits) and werewolves being super resilient, if not outright immune, to any damage that isn't inflicted by a silver weapon. This is usually rendered as a set number that all incoming damage is reduced by, typically rendered thus on a stat block: DR/X - Y, where X amount of damage skimmed off the top of any incoming damage not inflicted by Y and Y is the nature of the weapon or damage type necessary to ignore the damage reduction. For instance, a wererat might have DR/5 Silver.
Energy Resistance follows the same principle, but specifically applies to one (or, in some creatures, more than one) form of elemental damage. For example, a demon taking less damage from fire, or a yeti taking less damage from ice.
This is distinct from damage immunity, which prevents all such damage outright. Notably, energy damage and weapon damage are independent of both and do not interact with one another, with all energy damage ignoring damage reduction and vice-versa. This is why so many tough-to-hurt things are still vulnerable to fire.
While Pathfinder, in keeping with its status as the Hackmaster of third edition, kept the old Damage Reduction system, it did introduce rules whereby sufficiently-powerful weapons pierced certain kinds of DR just by increasing in enhancement bonus. This is the source of much civilized and respectful debate, with some arguing it's conceptually stupid and cheapens the exotic materials, while others argue that, from a gameplay perspective, having so many different materials and needing a golfbag full of weapons to fight effectively in melee wasn't adding that much fun to the game anyway and really hurt certain styles of play, like dual-wielding, many of which were already weak and didn't need to be punished, also like dual-wielding.
Notably, while previous editions (and Pathfinder) use this system exclusively, 2nd Edition instead had a system of Damage Resistance, which reduced any damage of the relevant type by an associated percentage. This wasn't unbearable, but was rather math-y. Fifth edition brought it back in spirit, but instead just halves all damage of the said type given, rounding down. It also tends to give all magic weapons the flat benefit of penetrating damage resistance of any kind.
Notably, the two systems actually incentivize different methods of play a little. For instance, Damage Reduction penalizes dual-wielding and multi-attacking in a number of subtle ways, including but not limited to having to maintain twice as many weapons to deal with it and being disproportionately affected by it, since having ten skimmed off the damage of each attack hurts the guy who swings four times for less damage more than the guy who swung once but hits really hard. Conversely, since Damage Resistance halves all damage, it swings in the other direction a little, though not as dramatically.