The accumulation of nitrious oxide in games has no real life counterpart. In real cars a limited number of capsules filled with NO2 have to be filled at the start of the race. In that way it is similar to fuel which you can't 'earn' during a race (except for a pitstop ofcourse).
The reason this mechanic in games exist is to encourage risk-reward gameplay. It appeared in games as the Burnout series where driving in oncoming traffic, drifting etc. earned 'boost'.
In the Need for Speed Undergound series boost was translated to NO2 (probably since it was featured in movies such as "The Fast and the Furious" so the general public were familiar with it).
It has since become a staple way of introducing the risk-reward challenge in arcade racers as it works really well (as a gameplay device).