Trade is a mechanic in the game that serves three purposes.
First of all, it allows you to bypass the money loss caused by selling things. It isn’t a perfect bypass- you can only trade away components and collectibles. However, because you trade them away at full value, this will often be more efficient than selling them (for 10% of their actual value) and then buying the items you could have traded for. This makes Trade practically an economic necessity, as it lets you avoid a lot of running around killing or gathering things purely for the sake of money.
Secondly, Trade gives you access to items you can’t otherwise find- or at least can’t otherwise find easily. If you need an item and have scoured an area for it without finding it, try Trading with NPCs. Frequently, one of them will have the item you’re looking for up for trade.
Finally, Trade gives you a way to get even more for less- if you Trade with someone and give them an item they particularly like, you can often get an extra item in return. These extra items may be useless or highly valuable, but they represent extra resources for you- and in any RPG, extra resources is good. You do need to keep track of what an NPC is likely to want. A character you see in a conversation about flowers isn’t likely to see the value in a machine part, after all.
Trade is also enabled by Affinity. Characters with names (and who thus appear on the Affinity Chart) are also willing to Trade with you. However, until you improve your Affinity with their hometown or area, they will only offer you a few items for Trade. As your Affinity with an area rises, though, they will begin offering you more items- and more interesting items- for trade. It will sometimes pay off wonderfully to go back to someone you already tried Trade with after you improve your Affinity with their region.
Keep in mind that every character who has a name is willing to Trade with you- but characters who haven’t got names are un-Trade-able. Until you’ve found every named character in an area, you have no way of being sure you know all the items available. That doesn’t mean you absolutely have to obsessively lurk around for hours to make sure you get everything you need- but sometimes you will want to.