Google said it was Benjamin Franklin but there are some questions that say "Who invented electricity Edison or Tesla?". I thought Tesla only invented the lightbulb.
Electricity is a natural phenomenon, so it could have not been invented, only discovered. This said, until 1930s it could have been said that the practical experiments concerning electricity or, to be more precise, creation an usage of the electric charge begun somewhere in mid-17th century. In 1936 a discovery in Mesopotamia challenged this notion when Wilhelm König found a small jar filled with asphalt and fitted with copper and iron rods during his excavation near Khujut Rabu, close to the location of the ancient city of Ctesiphon. Due to the proximity of the site to the modern capital of Iraq, the mysterious device became commonly known as 'Baghdad battery'. Although no descriptions of similar items are known to exist, subsequent excavation of more specimens led researchers to a conjecture, that such devices were indeed wet batteries using vinegar as the electrolyte and most likely utilized to electro-plate small items with gold. It is still not currently known whether this was the case (there is a strong evidence that the items were gilded through the thermal amalgamate process and the design of the battery is somewhat lacking). Assuming these actually were batteries, we also do not known whether users of these items even the simplest understanding of the principle behind the operation of the device or was it rather a result of a luck or trail-and-error process. Nevertheless, 'Baghdad battery', dated to the Sassanian period (early 3rd to mid-7th century CE) is often cited as the oldest known electrical device in the world, although veracity of this claim is still disputed.
Modern experiments with electricity, derived from the centuries-old occasional observations of the reaction of amber to friction and behaviour of the compass needles usually begin in the early 17th century or maybe last years of 16th century, with William Gilbert being usually credited as the first scholar to extensively work on this topic in modern times. Although primarily interested in the natural magnetism (he was the first to posit that the Earth itself is a magnet with a large deposit of iron at its centre), he also dabbled in the experiments involving static electricity, coining the Latin term 'electricus' (meaning amber-like) that was later used as the basis for the term 'electricity' by sir Thomas Browne in 1640s and describing what could have been construed as the first models of the electric fields and currents. Thanks to his experiments with magnetic compasses, he also constructed the first, primitive electroscopes capable of detecting static charges.
Few decades later, in 1663, German physicist (and mayor of Magdeburg at the time), Otto von Guericke built the the first electric generator using the rotation of the solid sulfur sphere to generate static electricity. This design has been developed further by the British physicist Francis Hawksbee, who in 1706 presented a machine utilizing an evacuated glass sphere filled with mercury vapour that allowed spectators to actually see the small discharges inside the sphere. In 1729, Stephen Gray noticed that the electrical force is transmitted not only through the air, but can also be passed through some liquids and solid objects, leading to the discovery of conductivity (the terms 'conductor' and 'insulator' in the context of electricity were later coined by by John Desaguliers, Newton's assistant and Gray's acquaintance (who also happened to appropriate some inventions of the latter using his position and reputation as the member of the Royal Society).
Since the early 18th century attempts have been made to capture and preserve the electric charge, leading to the invention of the first capacitors, built independently in 1745 by Ewald von Kleist from Camin von Pommern (now Kamień Pomorski in Poland) and Pieter van Musschenbroek from Leyden. The latter, being a renowned professor and scholar, is more commonly mentioned in reference to the first capacitor, as his invention became more widely known, leading to its common name 'Leyden jar' (although in 1746, Daniel Gralath, scientist and member of the Experimental Physics Society in Danzig wrote a petition to the French Academy of Sciences, stating that von Kleist build his device at least several months before van Musschenbroek did it). 'Leyden jar' has been used as early as in 1746 by Jean-Antoine Nollet who demonstrated that the electricity can travel through human bodies and metal objects even on a long distance. He was known for demonstrating this by applying a shock to a first person in a 'human chains' often including several hundred people holding hands or metal objects and showing that with subsequent people showing effects of the shock simultaneously). This device was used by Benjamin Franklin during his kite experiment in 1752, when he managed to prove that the atmospheric lightning are in fact electric discharges, not unlike those that could have been produced artificially by the electrostatic machines. Drawing from the conclusion of the French naturalist Charles du Fay who stated in 1733 that there are two 'types' of electric charge, he also presented the theory of the positive and negative charge, contributing to the later development of the concept of electric current.
Further research and inventions soon followed, with Ebenezer Kinnersley experimenting with electrical sources of heating in 1760s, Luigi Galvani demonstrating the influence on the electricity on the natural tissues in 1780s and thus laying the foundations for the fields for bioelectricity and Allessandro Volta developing several devices for measuring electricity and finally presenting the voltaic pile in 1800. In the early 19th century, the electricity and electromagnetism became better and better known thanks to the research by e.g. Hans Christian Ørsted, André-Marie Ampère and James Clark Maxwell. With Humphry Davy demonstrating the first electric incandescent device in 1807 and Michael Faraday constructing the first electric motor in 1821, electricity became a well-known, quite popular and most importantly, practical phenomenon.
And while we're at it, neither Edison nor Tesla did invent or meaningfully improved the lightbulb. It is a an older invention that has been around in its initial form years before either of them has even been born.