It's a two part answer. Lloyd Loard invented the first magnetic pickup in 1924. He was an employee of Gibson. The first "real" guitar was invented by the Electric String Company in 1931. Adolf Rickenbaker was amongst the designers of it.
George Beauchamp invented the first functioning elecric guitar, Harland Bernard Bodkin invented the first solid body guitars to feature pickups, and Adolph Rickenbacker invented the first hollow-body design.
Various electrically amplified guitars started being produced in the 1930's as amplification became necessary in big band situations. Gibson's ES-150 model from 1936 was one of the first well-known models of electric guitars.
Lloyd Loar, an engineer with Gibson Guitar Company, developed an electric pickup for use on violas and the string basses in 1924. Later LLoyd used this technology on a guitar.