Flywheels generally are added to mechanical systems to act as a stabilizer of motion, that is, they help the system maintain its speed. The flywheel adds rotating mass to the system, so once the system is spinning it is then more likely to keep spinning due to the inertia of the flywheel.
In an RC car engine, the flywheel helps the engine run smoothly when idling by providing a little inertia, ideally without adding so much mass that it slows down the throttle response of the engine.
The flywheel is also often used for starting the car. A spinning "starter" motor with a rubber wheel is pressed against the flywheel, forcing it to spin while the glow plug is also applied, thereby getting the engine's combustion cycle started. Once the engine fires, it will maintain the combustion cycle on its own, and the starter wheel can be pulled away and the glow plug removed.