A gasket for mechanical purposes is most frequently used when you have two pieces, usually made out of metal, and you want a good seal between them, so that no air or fuel as the case may be leaks.

For example, in a motor car engine, the engine has cylinders that pump up and down. There's the cylinder head, which sits on top of the main body of the engine, which houses the pistons. Between these two big pieces of metal, is a thin gasket made out of something like graphite. If you just bolted the two bits together, air would leak out in between the gaps since the casting process is not perfect, and there would not be enough compression in the engine, which would cause it to lose power.