You get traits starting at level 11. You have to buy three trait books during the course of the game to unlock them. At level 11, you pay 10 silver to get one. There are trainers in every major city (or just outside them) as well as around the Mystic Forge in Lion's Arch. You can go to any one of them. The one for your profession will have a book icon over his/her head.
You get your second book at level 40 and your third book at level 60 (at a price of 1 gold and 2 gold respectively). If you're playing the game you should be able to afford them by then.
In addition to what Vayne said, you can easily reset your traits if you screw up or just want to try a different build by talking to the trainer and choosing the reset option. It costs only a few silver, based on your level I believe.
I didn't like the way traits were unlocked in lotro. Sitting around killing the same type of creature over and over again to unlock a specific trait didn't really make sense to me at all. Kill these needlebreekers and you'll suddenly have this trait. It makes more sense, to me, to make it so that as you get better at your chosen profession, ie level, you learn how to do that profession better.
It also means you don't have to stay in one area or do one thing to unlock the traits. You can do it by doing pretty much anything in the game...events, crafting, WvW. The only thing that doesn't give you experience and unlock traits for you is SPvP...and all your traits are unlocked for that anyway.