Really bad attacks which force people to go into hospital often happen after a virus infection of your nose or chest. Some people get asthma if they take aspirin or other painkillers, and some get asthma from dusts or fumes at work. In a way, these things are all causes of asthma. You can inherit the asthma tendency from your parents, although people with asthma should not worry about their future children on this score. Things to do with a 'Westernised' lifestyle in developed countries clearly have a lot to do with how many people have asthma in a country.
Many people believe air pollution has something to do with it, though the evidence is very weak.
Childhood infections and exposure to substances from bacteria in a dirty environment seem to protect against allergies, and this seems to be the main reason why richer populations have more allergic disease. So research may in future show us a way to get the benefits of infection without the harm and so reduce allergy. So the causes of asthma are complicated. They include our genes, our exposure to things we become allergic to, and a general effect of our environment on the chance that these genes and things we become allergic to will cause trouble. But in some ways it is not as complicated as it sounds.