A flywheel at its most basic is a device to store energy. In the case of a flywheel used in automotive applications, it actually serves several purposes. First, it does store energy to help smooth out the torque and power flow of the engine as it runs through its combustion cycles. The flywheel gains energy as the engine accelerates, and stores it as rotational kinetic energy. It then gives some of that energy back to the system to help create momentum to carry the crank and pistons through the compression cycle and help optimize power delivery. Secondly, the flywheel also helps deliver rotational and torsional stability and balance to the engine’s rotating assembly (crank, rods pistons, etc.) in order to help the engine run smoother and reduce wear.
Next, most flywheels today also provide the power and torque transfer point between the engine and the vehicle’s driveline (clutch, transmission, driveshaft, axles, etc.). The flywheel bolts directly to the engine’s crankshaft and rotates at the same RPM as the engine. When the clutch is engaged, that rotation and accompanying power and torque are then transferred through the gears of the transmission (adjusted by the transmission’s gear ratios), to the driveshaft, then axles, then the wheels and eventually to the ground to move the vehicle. This of course is a simplified description, but it covers the basics.
In addition, most flywheels used in internal combustion engines also provide the mounting location for the starter ring gear, which creates the interface to initiate the rotation of the engine’s internals and start the combustion cycle (get the engine started).