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.
$670 for a bike for a kid that will outgrow it in 3 maybe 4 years? I'm sorry, though it is a nice bike, it's too nice for a 9 year old, if he was 15 or 16 and was into off road riding then I could see that bike being a good bike to get. On top of that the smallest size they make 26 inch and the largest he can get into is a 24 which may be too big which I won't find out until next saturday.