Do you understand what 'leads' are? That is where you need to start. The horse canters in either the left lead or the right lead. When he goes to the left, the left front and hind legs are taking the longer step. They have to be in order for a horse to have a foot to land on as it circles to the left.
When a horse circles to the right, the right front and right hind legs take the longer step. That is the 'lead' the horse is in.
A 'flying change' is when the horse changes from the right lead to the left lead (or the reverse) while it stays in the canter. There is a moment of suspension when the horse changes which front and hind leg are going to take the longer step.
When it is done at high speed, it is pretty automatic. The horse changes directions and automatically changes its lead in order to be able to make the direction change.
When done at a collected canter / lope at slow speed, it is a very difficult maneuver that takes great skill to properly teach to a very advanced horse. It requires rider control of the horse's shoulders, ribs and especially hips. When done incorrectly, the horse only changes leads in front and keeps the hind end in the previous lead. This is known as 'cross-firing' or 'dragging' a lead.