A Guide to Piglins in Minecraft
Piglins can be a valuable source of materials in the Nether, and their unusual behaviors can be used to get yourself out of dangerous situations. They are commonly found in Crimson Forests, Nether Wastes, and Bastion Remnants.
Although they are classified as neutral mobs, adult Piglins will normally attack players on sight unless the player is wearing at least one piece of Gold armor.

Behavior
Adult Piglins can spawn holding a Golden Sword, a Crossbow, or a Golden Spear. They often react as a group, so provoking one can quickly result in several nearby joining the fight.
Wearing a Gold Helmet, Chestplate, Leggings, or Boots prevents ordinary adult Piglins from attacking you on sight. Keeping at least one piece of Gold armor equipped is a useful precaution while exploring the Nether.
However, wearing Gold armor does not give you complete protection. Piglins may still become aggressive if you attack them, break certain Gold-related blocks near them, or open containers while they are nearby.
Piglins are highly possessive of Gold. Breaking blocks such as Gold Ore, Nether Gold Ore, or Blocks of Gold near one can cause it to attack. They may also become hostile when you open a nearby Chest, even if you placed the Chest yourself.

Be especially careful while exploring Bastion Remnants. Looting containers or mining Gold-related blocks without checking your surroundings can quickly attract a group.
Bartering
Piglins can be bartered with using Gold Ingots. This works differently from trading with Villagers: there is no menu or selection of offers. Instead, an adult Piglin accepts a Gold Ingot and throws a randomly selected item back to the player.
To barter, either drop a Gold Ingot close to an adult Piglin or use the Gold Ingot directly on them. The Piglin will pick up the ingot and examine it before returning an item. This process takes approximately six seconds in Java Edition and eight seconds in Bedrock Edition.
Possible rewards include Obsidian, Crying Obsidian, Fire Charges, Ender Pearls, Nether Quartz, Fire Resistance Potions, Splash Potions of Fire Resistance, and Dried Ghast Blocks, and more. Piglins can also provide Iron Boots or Enchanted Books with the Soul Speed enchantment. Java Edition may provide Spectral Arrows, while Bedrock Edition provides ordinary Arrows.
A complete list of possible rewards and their probabilities can be found in the Minecraft Wiki’s bartering article.
Using Gold as a Distraction

A Piglin that is examining a Gold Ingot will temporarily stop attacking. This can give you time to retreat, block off a passage, or equip a piece of Gold armor. However, a Piglin that you have directly damaged may be too aggressive to distract with Gold until it calms down.
Gold armor only prevents default hostility. It will not necessarily calm a Piglin that you have already provoked by attacking it, opening a nearby container, or breaking protected Gold-related blocks.
Baby Piglins
Baby Piglins cannot barter. They may still take a Gold Ingot, but they will not give you anything in return. A Gold Ingot taken by a Baby Piglin is dropped if it is killed.
Server Tip: The mobGriefing Game Rule
If the mobGriefing game rule is disabled, Piglins will not pick up Gold Ingots dropped on the ground. You can still barter by using a Gold Ingot directly one.
Other Interactions

Piglins are collectors of many Gold-related items. Gold Ingots are the only items that can be used for bartering, but Piglins may also approach, examine, collect, or equip other items that they consider valuable.
They can pick up armor and weapons from the ground. They generally prefer Gold equipment, even when a stronger piece of armor is available. For example, a Piglin may discard a stronger Chestplate in favor of a Golden Chestplate.
This means that dropped equipment can accidentally make a Piglin much more difficult to defeat. Be careful when discarding items or returning to the location of a recent death.
Piglins that pick up items or equipment will no longer naturally despawn. However, items stored in it's hidden inventory are not guaranteed to drop when the Piglin is killed. It is best to avoid throwing valuable items near Piglins unless you are prepared to lose them.
Piglin Brutes

Brutes are stronger variants of Piglins that protect Bastion Remnants. They carry Golden Axes and attack players on sight, regardless of whether the player is wearing Gold armor.
Unlike ordinary Piglins, Piglin Brutes cannot be distracted with Gold and cannot be used for bartering. Ordinary Piglins in the same Bastion may still remain neutral if you are wearing Gold armor and avoid provoking them.
Fears and Rivalries
Piglins have several unusual interactions with other Nether mobs.
Idle Piglins are frightened by Soul Fire, Soul Torches, Soul Lanterns, lit Soul Campfires, Zombified Piglins, and Zoglins. These can sometimes be useful when designing routes through areas populated by Piglins. However, an aggressive Piglin will no longer flee from Soul Fire-based blocks.
Piglins may also hunt Hoglins for food. If a group successfully defeats a Hoglin, they may gather near the location and occasionally perform a short victory dance.
They are hostile toward Wither Skeletons and will attack them on sight.
Taking Piglins Outside the Nether
Ordinary Piglins cannot permanently live in the Overworld or the End under normal survival conditions. After spending approximately 15 seconds outside the Nether, a Piglin transforms into a Zombified one.
A Zombified Piglin cannot be used for bartering. Wearing Gold armor also does not prevent a them from becoming aggressive if it is attacked.

Quick Tips!
Bring at least one piece of Gold armor and a few spare Gold Ingots before exploring the Nether.
Remain cautious inside Bastion Remnants. Gold armor will help with ordinary Piglins, but it will not protect you from Brutes.
Avoid opening containers or mining Gold-related blocks while Piglins are nearby, even if you cannot currently see them.
Only use Gold Ingots for bartering. Throwing other valuable Gold-related items near Piglins may cause them to collect the items without giving you anything in return.
Do not assume that you can recover an item after a Piglin picks it up.