No, gap insurance does not cover your transmission or engine for damages. GAP insurance is used to cover the difference between what is due on a car and the actual cash value if a new or leased car is totaled before the balance of its loan or lease is paid off. Again this insurance kicks in if the vehicle is declared a total loss. Coverage for specific parts of your vehicle, such as the engine or transmission, to be repaired or replaced is usually done with by means of a warranty. Warranties can be purchased at dealerships, financial institutes or online. Some financial entities also offer mechanical breakdown insurance if you are worried about having mechanical issues with your vehicle.
However, if the engine needs to be fixed do to a covered loss, an accident that caused engine problems, then this may be enough to total out your vehicle. If your car was totaled out due to engine problems then your insurer would need to pay ACV in order for GAP insurance to kick in.
With a normal auto insurance policy neither collision nor comprehensive covers mechanical problems, such as engine failure, that is not related to an accident that would be covered by the terms of your policy.
Some financial entities and car insurance providers offer mechanical breakdown insurance (MBI). Companies such as Geico offer Mechanical Breakdown Insurance which is designed to protect you from expensive repair bills. A deductible is typically involved but after that is paid MBI normally covers repairs to all mechanical parts of the car - except for maintenance and those worn out due to normal wear and tear.
It is wise to have a mechanic look the vehicle before purchasing a used car.