I'm very new to gaming and I've got a lot of data crystals but when I visit a vendor my purchases are automatically deducted from my credits and I see no option to pay with crystals instead. What do you have to do in order to pay with data crystals?
Different vendors will accept different currency.
Some vendors will only accept money, others will accept Crystals and others will only accept currency that you receive from certain re-occurring events.
Data crystals are most commonly used to purchase gear once you reach level 50, you can find these vendors in the supplies section of the fleet or you can use these as you level to buy new mods, armoring's and enhancements.
So, to answer "how to use data crystals to purchase something":
Simply find a vendor that will accept them as currency and they will automatically be deducted from your inventory.
The currency and amount needed to buy an item is always listed to the right of the item.
Some items will require a combination of different currencies to buy it.
There are vendors on Oddessan(or however you spell that) that sell stuff for them. One vendor in the Underworld section of the command bunker sells decorations, pets, and a certain Zakuulian group's armor.
A second vendor in the cantina on that planet, sells companion gifts and those crate thingies you turn in to the 4 main contacts. This vendor is right by the entrance, leaning up against a jukebox thing.
The main place for characters to spend crystals is on the Fleet, where you go after completing the first planet. In the outermost ring of the Supplies area you will find vendors selling mods at different levels — buy the highest level mods you can use (equal to your level or lower) to slot into Moddable/Custom gear. This is the best way to gear up with minimal effort. You can get moddable gear from drops, a level 8 vendor in that area, the Cartel Market, or the GTN.
At endgame, there are also some crystal gear vendors in that area on the opposite side. Such vendors are also found on Odessen as mentioned in the other answer, with other vendors in Section X, the Black Hole, and Oricon.