Underneath the gas block/front sight base there is a hole drilled through the barrel to the bore. This is called the gas port.
When a cartrdge is fired, the expanding gases push the bullet down the barrel and as the base of the bullet pases by the gas port, some of the expanding gases are directed up through the gas port.
Directly above the gas port of the barrel, there is a corresponding port in the gas block/front sight base. The expanding gases travel up through this port to the gas tube.
Upon reaching the gas tube, the gases are channeled into the corresponding port in the gas tube and then flow rearward through the gas tube to the upper receiver.
Inside the upper receiver the gas tube connects with the gas key of the bolt carrier and the gases drive the bolt carrier to the rear thereby cycling the action of the rifle.