In a conductor, such as a metal, charges are free to move due to the presence of mobile electrons. When an external electric field is applied to a conductor, these free charges redistribute themselves within the material until they reach a stable configuration. This redistribution creates an electric field inside the conductor that exactly cancels out the external electric field.
However, it's important to note that this only happens in static conditions or when the conductor is in electrostatic equilibrium. In other words, the charges have stopped moving and there is no current flowing. If the electric field were not canceled out within the conductor, charges would continue to move until equilibrium is reached. This cancellation of the electric field inside the conductor is known as electrostatic shielding.