Throughout his career as a poet and playwright, William Shakespeare was no stranger to utilizing various forms of real-life (Richard III, Julius Caesar) and artistic inspiration for his work. Of all his works, The Tempest has perhaps the most mysterious and undeterminable origin; there is no clear real-world parallel, nor is there an obvious play preceding The Tempest that Shakespeare clearly reworked.
Critics have many different suggestions as to where Shakespeare's inspirations from The Tempest originate. One possible source is a play by the German playwright Jacob Ayrer, titled His Fair Sidea. The Tempest and His Fair Sidea share a number of plot similarities, though minor, that seem noteworthy. However, His Fair Sidea did not receive publication until well after The Tempest's premiere, and as a result, it can be surmised that Shakespeare's knowledge of the play would have been minimal at the time of his writing of The Tempest.
Another possible source is the real-life shipwreck of two English ships in the Bermudas in 1609. After running into a massive storm (similar to the titular Tempest), these ships were essentially lost at sea for several months. Eventually, the ships were located and all the passengers aboard were found alive. Interestingly, several seamen aboard these ships were acquaintances of Shakespeare and quite likely gave lurid descriptions of their shipwreck.
As always, Shakespeare's work was influenced in part by the culture and society in which he lived. This can be seen clearly in his careful characterization of Prospero as a rational and scientific magician. By avoiding making Prospero an occultist or a black magic-practicing wizard, Shakespeare avoided significant controversy.
As a whole, The Tempest is perhaps Shakespeare's play of the most mysterious origin. It seems as though Shakespeare had a wide number of influences while writing The Tempest, with no single source standing out significantly over the others.