Electric guitar sound is affected, among other things, by the way the wood absorbs the vibrations of the strings. The sustain and the brightness of the sound comes, in part, from the wood used. Availability, workability and visual properties are also important.
The most popular rock guitars are Fender Stratocaster and Gibson Les Paul. Strat bodies are usually made of ash, alder or poplar and Les Paul bodies are mostly made of mahogany with a maple top. Strat necks are made of maple while Les Paul necks may use mahogany or maple. Frets can be pressed directly on a maple neck or the neck may be laminated with a harder wood like rosewood or ebony.
As you can see, the woods used on these two guitars are quite different, yet they're both very popular choices for rock music. So, it's about what sound you want to obtain.
Custom guitar parts supplier Warmoth has some good information on so called tonewoods and neck woods.