There are two main ways to buy items, either by trading with your city or by trading with other players.
Buying from your cityEdit
You can only buy items from your city when you are standing on a Cantina , Grocery , Retail Store or Broker . The Broker is able to sell all the items in your city inventory. The others are a bit more specific in what they sell. Once you are standing on the relevant tile you can then query your city on it's sellable inventory by pressing the F3 key to bring up the comms window. From there navigate to the trade tab if it's open, or open a new trade tab by selecting it from the "open standard channel" button at the end of all the channel tabs. Once in the trade tab, you press the solicit sales button at the bottom (the green eye) in order to bring up a list of all the items in the game, you can click on the categories along the left hand side to query all the items in that category immediately or you can click on the categories along the top to search for a specific item in that category and then click the solicit item button at the bottom of the window. This will cause your city to open a new tab in the comms window (unless one is already open for it) with a list of all the relevant items the city has for sale or a negative response if the city has none of a specific item for sale.
You can then click on the item you want and click the bid button (small pile of coins) at the bottom of the comms window. this will bring up a small box confirming how many of the item you want and how much your going to pay. Cities rarely accept less than the requested amount (and even then only by -1 or so) As long as you have room in your inventory the items will then be transferred. If you do not have enough room, the game will calculate how many you do have room for and sell you as much as it can.
Alternatively you can buy items with your ship funds by landing on any landing pad in your city. This requires your ship to have enough funds for the purchase and enough space in it's inventory to take on the new items.