Mountain biking can be an expensive hobby if you dive right into it without doing the proper research first. 
I am hesitant to say that there is one single best mountain bike in this affordable price range, because in reality there are several that can give you the experience you are looking for.
Listed below are three of the best mountain bikes under $500 enabling you to traverse narrow gullies and climb steep hills to the best of your ability.

Smith & Wesson Perimeter 24-Speed 18" Mountain Bicycle

This offering from Smith & Wesson is constructed from a highly durable 18-inch alloy hardtail frame and also has a luggage rack and water bottle storage compartment for up to 2 water bottles at a time.
This bike is usually priced at around $500 so it is at the expensive end of this category but it is one quality piece of equipment, with even some police and security forces worldwide utilizing these bikes for patrol services.

As the title suggests, this is a 24 speed bike but to make shifting through those gears easier you get to take advantage of the SRAM SX-4 twist shifter and the bumps will be a whole lot easier to ride thanks to the RST fork suspension.

Smith & Wesson Patrol Bike Frame, 22-Inch
Amazon Price: $1,067.62 Buy Now
(price as of Jul 26, 2016)

Schwinn Protocol 1.0 26" Men's Full-Suspension Mountain Bike

If you need a bike that can handle the toughest terrain you can throw at it then I urge you to check this Schwinn bike out. 

Priced at around $300, this mountain bike has a full suspension frame and a front disc brake for when that extra stopping power is required.

In addition to a total suspension fit-out you also get a Shimano 24-speed gear system and Shimano EF-50 trigger shifters to make easy work of changing gears.

Perhaps the only slight downside to this bike is the high amout of tuning that is required in order to get the best ride possible. 

I would recommend that if you don't have the technical know-how required to tune a bike for maximum performance that you pay someone to do it for you.

Bike Enthusiasts just love this one.

Schwinn Protocol 1.0 Men's Dual-Suspension Mountain Bike (26-Inch Wheels, Red)
Amazon Price: $399.99 $250.00 Buy Now
(price as of Jul 26, 2016)

GMC Topkick Dual-Suspension Mountain Bike

The thing that is unique about the GMC Topkick is that it features a full, floating beam suspension that incorporates spring and elastomer technology.

This allows you to have an extremely comfortable and cushioned ride – for example traversing over curbs (which is typically a rough experience on a hardtail bike) is an absolute pleasure on the GMC and this is definitely something I would like to have on my own bike one day.

The Topkick also has a strong aluminum frame with front and rear disc brakes but you do sacrifice a bit of agility with that extra strength, this bike weighs around 38 pounds which is nearer to the heavy end of the scale.

Perhaps the best thing about this bike is the price. At around $300 you will not find a better equipped model in this price range. Similarly fitted out bikes with front and rear disc brakes and floating suspension can retail for as much as $1000 depending on the brand and where you look.

Apart from a few minor practicality issues this is definitely a bike I give a very high recommendation to and it is certainly a contender for the best mountain bike under 500 for many enthusiasts.

Best Brands for mountain bikes 2013

This is an all time favorite and still going strong

GMC Topkick Dual-Suspension Mountain Bike
Amazon Price: $299.99 Buy Now
(price as of Jul 26, 2016)