Almost everyone knows that exercise is good for you. It's been known and written about for more than two thousand years. But it wasn't proven by science until the late 1940s, when a Scottish epidemiologist named Jerry Morris performed a large scale survey of 31,000 people that worked as bus drivers or bus conductors, and found that the bus drivers died earlier. He concluded that there was a 0.27% chance per year of a driver having a heart attack, but this was reduced by almost a third to 0.19% for conductors.
The main difference between the two professions, is that bus driving is a sedentary job. You sit for hours a day, moving just your arms and feet. Conductors, on the other hand, were constantly running up and down the stairs on the buses, moving forwards and backwards in the aisles, constantly moving.
Modern day jobs such as programming are the equivalent of the bus driver's job. In fact, they may be worse, because a bus driver at least needs to move the feet. Programmers and other typists do not.
A person who does 5-10 minutes of moderate exercise a day has a 20% lower risk of dying per year than a person who does no exercise. Even a brisk walk will do.
If you increase that to just 11 minutes per day, your risk drops to 31% lower than someone who does no exercise. 20 minutes per day gets you 37%.
There is no point going any further than that - exercising a full 22 hours a week (more than 3 hours a day) will only drop your risk by 40% - just 3% more than the 37% you get for 20 minutes per day.
On the other hand, too much exercise is bad for you.
Take running, for instance. If your exercise of choice is to run, you reduce your all-cause mortality by about 19%, and are much less likely to die of a heart attack. However, if you run more than 32km per week, faster than 11kph, or more than 5 times a week, you are actually damaging your health instead, including through musculoskeletal trauma, metabolic derangements, cardio-vascular stress.