I have spent hours on this topic and I seem unable to make sense of it. If air moves from high pressure toward low pressure, and wind is the movement of air due to differences in pressure, how can, for example, a warm front occur? What can bring a warm air mass to overtake a cold air mass? Shouldn't just the cold air mass move toward the warm air mass, as the warm air mass has lower pressure and winds will be blowing in that direction?
Well, to start with, air does not strictly go from high pressure to low pressure. For example, in geostrophic balance winds will move perpendicular to the pressure gradient.
Fronts form in a process called frontogenesis. To say that it is complicated might be an understatement. This process can be simplified into the Norwegian Cyclone Model. As an analogy, the cold air usually is the "bully" as it is denser. As the cold air is denser, it undertakes the warm air. Meanwhile, the warm air is less dense and rises over the cold air. Eventually the cold front catches up with itself, cutting off the warm air, causing an occluded front. With the lack of warm air to the center of the low, the frontal system slowly dissipates. There is a far more technical description, but for that, I would have to discuss vorticity advection, positioning of jet streak, etc.