A distortion pedal or overdrive pedal is really just an amplifier, just like the preamp part of your guitar amp. Think about a table radio in your home. Tune it to a station. Turn it up loud. there comes a point when you turn it up farther and it starts to sound crappy. The speaker starts flapping or the sound gets all gravelly, or whatever - it sounds bad. All that is distortion. Distortion merely means whatever comes out is not like what went in.
And on many guitar amps, if you keep turning the amp up, after a point, the sound is no longer clean, it gets all... distorted.
Some distortion is pleasant, some sucks. And not everyone agrees on which is which.
There are many ways to cause distortion. Poke holes in your speaker cone, and it will become distorted. Most littel OD pedals basically amplify the signal from your guitar so much it runs out of room inside electrically. The voltage changes run into the floor and ceiling. We call simple limits on the signal "clipping."
Electronic circuits are combinations of various parts to do a job. What actually makes the distortion is the whole circuit. The parts work together as a team. Think of the motor in your car - it makes power to turn the wheels. One might ask, "What actually makes the power, is there a part inside?" And the answer is that the motor makes the power. it needs all the individual parts to do it, but no one part is the source of the power.
Just so in your distortion pedal. A simple circuit might be based around an integrated circuit chip we call an "op amp." Op amps are capable of amplifying. But one needs certain voltages fed to it (like a car motor fuel line) to work. And there are other parts that determine how MUCH it amplifies. (the throttle) Some parts need different voltages from other parts, so certain parts are used to keep them apart. (fuel filter keeps dirt out of the carbuerator) Some parts might be there to set or alter frequency response or tone. (gear shift)
Of course some circuits are real simple - a transistor or two and a few parts, or maybe one little op amp IC. other pedals may have several op amp ICs and use one to feed the next, which feeds the next etc. That is more complex, but it allows the whole circuit to do more than just one section could. (8 cylinders can make more power than 4 cylinders) And there are extremely complex pedals that use digital signal processing to get various effects like reverb and chorus.
A boost pedal might be just a little extra amplification without pushing things too far, while a distortion pedal adds a LOT of extra amplification. In practice the two would not be identical, but you could take a distortion pedal and only turn it up a little but and use it for a boost.
I hope this simplistic exlanation helps. What you are really asking is how does electronics work, and well, that is a lot to explain in a post or two.