Confused about substitution in grammar in certain cases
There's no particular reason why the first $T$ should be replaced by $empty$. The other replacement would have been equally acceptable. A grammar rule says "you can replace this string by this other" and no more. In other words, a grammar may generate several strings, depending on which of the grammar's replacement rules are called into play at any stage.

In answer to your last question, there are no rules to specify which substituition you use: the choice is up to you.