At the beginning of a word, one clue is to use ח if it begins with that sound, because when כ is the first letter it has the hard k sound. Of course, then you still have to deal with the choice between ק and כ.
For the T sound, you will probably encounter many more words beginning or ending with ת than with ט. You've probably noticed that ת is a common ending letter for feminine words. Loanwords typically use ט for the hard T sound, but may use ת for a th sound, e.g. מתמטיקה (mathematics).
Pronounced the same in modern Hebrew. Which one we use when writing? Why the right one, of course... For most words exactly one of the homophonic pair is the correct one, and you have to memorize it. My son is in second grade now, and learning which of the homophonic pair to choose for the given sound is probably the biggest challenge he and his class mates face now...
LindaEly1, here's one source