One reason a gate resistor is used is to slow down the turn-on and turn-off of the MOSFET. (This is more relevant to power circuits that switch a fair amount of current.) While it may seem that very fast switching is desirable, because of lower switching losses, it can result in ringing due to parasitic inductances, leading to electrical noise problems.
Other factors, besides switching speed, affect the amount of ringing: the physical layout of the circuit; the properties of the MOSFET, especially the switching characteristics of its body diode; any snubbers or capacitors that might be present; the level of the switched current.
A typical gate resistor value would be a few ohms to a few dozen ohms. Sometimes a second resistor in series with a diode is used in parallel with the gate resistor to separately adjust turn-on and turn-off behavior.
The choice of value is a trade-off between switching losses and ringing; the value may not be settled until the circuit is built and tested. One way to choose a value is use the smallest value that reduces ringing below the level that allows the product to pass any EMC certifications that are needed.