Flu is a disease caused by a family of related influenza viruses. Pandemic flu is always caused by the influenza A virus. Influenza A has two surface antigen proteins, hemagglutinin (18 flavors) and neuraminidase (11 flavors). A particular flu strain is named after which flavors of these two proteins it has - for example, H3N2, or H5N1.
Influenza A evolved in birds, and stayed there for at least thousands of years. It crossed to humans later, maybe during historic times - different sources give suggest dates as early as 500 BC or as late as 1500 AD. It probably crossed over multiple times. Maybe it died out in humans after some crossovers, stuck around in birds, and crossed over from birds to humans again later.
During historic times, the flu has followed a pattern of big pandemics once every few decades, plus small seasonal epidemics each winter. The big pandemics happen when a new strain of flu crosses from animals into humans. Then the new strain sticks around, undergoes normal gradual mutation, and once a year enough mutations accumulate to cause another small seasonal epidemic (Why is this synced to the calendar year? See here for more).
The severity of any given flu epidemic depends both on the innate severity of the virus, and on how closely the human population’s circulating flu antibodies match the epidemic strain. Humans usually have good antibodies to the seasonal flu, because it’s only slightly different from last year’s seasonal flu. For the big new animal crossovers, the level of protection provided by existing antibodies is kind of random. Older people may have antibodies left over from the last time that particular flu crossed over from animals to humans; younger people probably won’t. In some cases, people’s immune systems will be permanently synced to the first flu they encounter, with less protection against subsequent versions.