There has never yet been a case (that we know of) of terrorists or non-state actors getting control over nuclear weapons or fissile material (the fuel for bombs) in the real world. There have, however, been fears of this possibility for many decades. The rise of domestic and international terrorism in the late 1960s/early 1970s led to the flowering of this genre of fear (and books, films, etc.) as it became clear that the technical "know-how" to make a crude nuclear weapon had been reduced since the 1940s, and because there was by then many hundreds of tons of fissile material in the world, sometimes kept in not-completely-secure conditions. And even "secure" facilities could suffer from insider threats: if you only need kilogram quantities of fissile materials, and your facility processes tons of it, then the margin of error for detecting stolen or diverted material is very slim.
There may have been stolen or diverted material. In 1965, a civilian processing facility near Apollo, Pennsylvania, "lost" more than 300 kilograms of enriched uranium (enough for several bombs, depending on the enrichment level). Whether the material was simply lost in the various conversion processes (again, when you are dealing with tons of material, even small percentages of loss add up to significant quantities) or was diverted (the main suspect here is Israel) is not totally known. You can read more about the NUMEC/Apollo Affair here. As an aside this incident plays a major role in at least one fictional nuclear terrorism story (Tom Clancy's Sum of All Fears).
The most important book for drawing the threat of fissile material theft (and from that, nuclear terrorism) to broader attentions, and responsible for "kicking off" a lot of nuclear terrorism literature, is John McPhee's The Curve of Binding Energy (1974), which profiled the Los Alamos nuclear weapons designer Theodore B. Taylor. Taylor had since the late 1960s been trying to draw attention to this issue; he felt that nuclear weapons were trivial to make if you had the fuel, and he worried that it was too easy to acquire the fuel. McPhee's book, first serialized in The New Yorker, goes through Taylor's life and his horror scenarios — not just nuclear weapon use, but nuclear blackmail: what would happen if a terrorist used a nuke and then threatened to use more? For Taylor this was almost the worst possibility because it would cause mass panic, breakdown of democracy, evacuation of cities, etc.
Taylor's work (via McPhee, and both through his own later publications, like Taylor and Willrich's Nuclear Theft: Risks and Safeguards, 1974) was not meant to just scare people, but to compel a policy shift towards increased fissile material safeguards. That is, make it harder to steal fissile materials, and also avoid technological choices that might increase the amount of fissile materials in civilian hands (such as plutonium reprocessing). People sometimes "got" that message, but more often they just worried about the terrorism. The modern "nuclear terrorism" genre was essentially spawned at this point, sometimes emphasizing Taylor's arguments, sometimes not.
A scholarly article which goes into how this was seen on the US side, especially by nuclear agencies, is J. Samuel Walker, "Regulating against nuclear terrorism: The domestic safeguards issue, 1970-1979," Technology and Culture 42, no. 1 (January 2001): 107-132. It is of note that official attention to this issue in the US really began around in 1972, after the much-publicized terrorist activity at the Munich Olympics. After seeing the havoc that a well-organized and dedicated group of international terrorists could achieve (something much more impressive than the "leave a bomb and tell you about it" terrorism of the Weathermen, or the "firebomb a defenseless church" of the KKK), the Nixon administration directed all federal agencies to take international and domestic terrorism into account whenever they made security determinations.
That the 1970s were a hotbed of terrorism is sometimes surprising to Americans today, who think of 9/11 as the decisive moment. In terms of "incidents" of domestic terrorism in the USA, 1970s were far worse than any other period; in 1971 alone there were 110 non-hoax, successful bomb attacks in the US alone. (Graphs are slides from a class I teach; data is from the Global Terrorism Database.) However in terms of fatalities and injuries, later periods have moments that are much worse, and 9/11 stands out. Other than 9/11, one never has a terrorist incident in the US that involved more than 200 fatalities, and other than the Oklahoma City bombing of 1995, there were no incidents with more than 50 fatalities.
The fears of nuclear terrorism unsurprisingly have been tailored (no pun intended) to the times in which they are situated. So the fears of the 1970s tend to be about ideological terrorists modeled on the Weathermen, the KKK, and the PLO, all of whom were major "terrorists" of the 1970s. By the end of the Cold War, it became about ex-Soviets or diverted Russian fissile material. By the mid-to-late 1990s, and especially after 2001, it became about Muslim fanatics.
Anyway. There is much more one could say on this, and in fact my book which comes out next summer (on the history of nuclear secrecy in the US) has a rather long chapter subsection on "Atoms for Terror," which is all about how this trope developed and its implications for policy. But the above is a brief overview. So far, nuclear terrorism has remained a mostly hypothetical threat — there are indications that terrorists have desired nuclear weapons, and some (like Japan's Aum Shinrikyo group) have even tried to make concrete steps in this direction, but as far as we know, none have ever gotten very close to acquiring the necessary fuel for a weapon. Whether that is because the fuels are well-kept, or the agencies of detection very good, or because we are simply unaware that they have yet done it, or because we are lucky is unknown — and part of what makes the issue unsettling.