While not every dishwasher uses an air gap these days, those that still do see it serve an integral purpose. The air gap is responsible for preventing the backflow of water into your dishwasher. The wash water that is filled with bacteria is safely ferried down the drain and prevented from flowing back into your dishwasher. This keeps your dishes clean and sanitized. However, if the air gap is leaking or otherwise not functioning properly, then it will not do this important job and it is likely that the wash water is flowing back into your dishwasher. It is worth noting that after fixing this issue, you will need to rewash that load of dishes.
The number one cause of a leaking air gap is a clog. While the wash water is filtered to prevent large food particles from causing clogs, some particles do get through. They can plug up the air gap over time and cause it to stop functioning. This is why your first step when troubleshooting this problem should always be to remove the metal cap from the air gap and make sure nothing is blocking it. If you do see that it is gunked up, you will need to remove the blockage with tweezers.
After that is done, you will want to run a drain snake through the drain hose just to make sure that there are no clogs deeper in the hose. Ignoring them will likely result in a blocked hose later down the line.
New Garbage Disposal
This is a less likely cause, but if you have recently installed a new garbage disposal, then you likely missed a step. In garbage disposals, there is a small knock out insert where the drain hose connects to the garbage disposal. This is something that is easily missed, but crucial to remove. You will need to go in and knock out the plug before the dishwasher and air gap will function properly.