I know this is going to sound crazy but I wouldn't buy either because they come with a suspension fork which at the price points those are selling for the fork will be a problematic after about 1000 miles and you'll wish you never got the bikes. Of course you could upgrade to a much more expensive front suspension fork later when the original goes bad which it will do and never have issue again except the paint on the forks won't match the bike anymore. On those lower priced bikes with front shocks the company also cheapens the component package and the frame so they can fit a more expensive suspension fork vs a rigid fork into that price point. Also cheap suspension forks will not do well on fast rough terrain anyways so you might as well go rigid.
Personally I would be looking for bikes with rigid forks for that kind of money.
But if you're deadset on one of those bikes the Giant has a tiny edge over the Trek, but fit will become more important than a tiny technology lead.