You can buy items from NPC's and sell the items that you do not want any longer to some NPC's.
Click on the merchant NPC who is selling the item you want. His/her inventory will be on the left, and yours on the right.
Right click on the item you want to buy, this item will be in your inventory.
Or drag it to your inventory. You can also hold Shift + Right click and buy 5,10,20 or fill up your inventory.
Drag this item to merchant NPC's inventory and release to sell or hold Shift + left click the item to sell.