How do kids get athsma?

Inherited tendency. Most asthma is part of the allergy/eczema/asthma triad which is controlled by several genes. Various factors controling the mechanics in lung pasageways trigger airway tigtening or relaxation over time an imbalance with excess tightening will emerge. Infection may trigger this in infancy but irritants, & other triggers will dominate. Meds can control it but true asthma is a lifelong tendancy.
Many factors. Many infants have predisposing factors such as family history as well as a history of atopy or cows milk allergy. Some babies wheeze because they have reflux, others develop chronic wheezing problems secondary to infections such as rsv. Do not forget environmental factors such as second hand smoke and exposure to fumes.
Genetics and. Environmental exposures; tylenol (acetaminophen) and nsaids; early viral infections of the upper airway all appear to be additional risk factors in addition to genetics. Asthma is not a single disease, but rather a syndrome or cluster of symptoms - so it is not clear which factors contribute more to which "type" of asthma.