What is the difference between hypersensitivity pneumonitis and asthma?

Very different. Hp is a hypersensitivity reaction usually to some organic material usually mold, but also food particles, bird droppings, pets, grains, etc. Asthma presents with mostly reversible airway obstruction due to exercise, allergens, infections. Both can present with sob, cough, wheezing, but hp can also have fever. Hp usually resolves or kept from turning into fibrosis, once removed from trigger.
Exposure. Asthma is a disease of chronic inflammation in the airways. Usually it's genetic. It can cause wheezing, shortness of breath, and even chest pain. Hp is a type of allergy reaction that happens in the air sacs. Symptoms can be like asthma, but it is usually brought on by exposure to any of a number of organic substances - from fungus to feathers. Chest xrays and scans are usually abnormal too.