It's a hardened steel bar that connects the piston to the connecting rod. There's six of them in a V-6 engine. All of those parts are carefully machined to very exact sizes. Usually the pin will slide through the holes in the piston with thumb pressure, but there is an "interference" fit in the connecting rod. That means the pin is larger than the hole it's going through by a few thousandths of an inch. A special hydraulic press is used to force those pins in, then the friction holds them in place.
It's not too common for the wrist pin itself to wear because it's steel and it has been heat-treated or chemically hardened. The pistons are made from aluminum or related alloy so they are the most likely part for that hole to wear. Once that happens, there will be a little movement between the parts, and that allows a tiny hammering action to take place. As the hole grows bigger there's more movement and more hammering so the hole gets bigger faster until you hear it outside the engine. Usually it's just a matter of time before something breaks.
You may have heard of the "four-stroke" engine. All car and truck engines use four strokes of the piston. In the first one, the crankshaft and connecting rod pull the piston down which causes it to suck in air and fuel. Next the crankshaft pushes the piston up to compress that air. That action is pressing the connecting rod and piston together. In the first stroke it's pulling them apart. That's where the movement comes from between the piston and wrist pin that causes the noise.
If you'd prefer a picture of what the parts look like, do an internet search or I'll find something for you. A picture is worth 999 words.