The answer to 'what causes P-trap' is a P-trap is a curved section of pipe under a sink or drain that creates a water seal to prevent sewer gases from entering the home. This U-shaped pipe is designed to hold a small amount of water, which acts as a barrier to prevent odors and pests from coming up through the drain.
The water in the P-trap creates a physical barrier that blocks sewer gases from entering the home. As water flows down the drain, it creates a seal that prevents air from being sucked back up through the pipe. This helps maintain proper air pressure in the home's plumbing system and stops unpleasant sewer smells from escaping into the living space.