Guitars had been around for hundreds of years before the first electric guitar was made. The traditional guitar made use of a hollow body which served to amplify the sound (violins, ‘cellos have a hollow body for exactly the same reason, it’s just like when you cup your hands around your mouth to increase the volume of your voice).
In the electric guitar the hollow body was replaced with electromagnetic pickups. These electromagnetic pickups sense the movement of a metal string vibrating above them and convert that information into an electrical signal.
An electrical signal is induced in the pickup because the metal string cuts across the magnetic field of the electromagnet. When this happens and electrical charge is induced.
The small electrical signal that is induced in the pickup by a moving string can then be further amplified by an ‘amplifier’ and later transformed.
So while the electric guitar is a new instrument, it isn’t completely new. Only one part of the guitar (the amplification section) was changed.