The history of the "fictional POTUS" has always fascinated me. It's a character who recurs frequently in modern art, from the succession of Presidents on 24 to Jed Bartlett on The West Wing to the endless string of Presidents weathering various apocalypses in disaster movies. There have also been plenty of real Presidents who have appeared as characters in various works -- whether incidentally, as with something like Jon Voight's portrayal of FDR in Pearl Harbor, or as a direct focus, as with Daniel Day-Lewis' performance in the title role in Lincoln.
How did all of this begin, though? What are the earliest examples in each case?
I'm having trouble finding sources about literature, but I found some great works about the history of fictional and fictionalized presidents in the movies. During the silent film era, filmmakers preferred to base their presidential films off of real presidents. Abraham Lincoln was a particularly popular subject, having been portrayed in at least half a dozen films in the 1910s and 1920s.
Sarah Miles Bolam asserts that the first fictional US presidents in film came in the 1930s. Gabriel Over the White House (1933) in particular highlights the attitude at that time: at the height of the Great Depression, people wanted a compassionate, activist president who could solve the nation's problems, and that was precisely the type of president portrayed in the film.
There were no fictional presidents in films made in the 1940s, and five in the 1950s. This could be ascribed to the gravity of World War II followed by the era of the Hollywood blacklist. But by the 1960s these films started to be more numerous, and questioned the infalliability of the highest office in the land (think Dr. Strangelove). In the 1970s, post-Watergate, many of the films were comedies poking fun at the office, and in 1972 another milestone arrived: the first black president in film (The Man).
In the 1980s, 1990s, and 2000s, fictional presidents became more and more frequent, often in science-fiction and action movies.
Edit: Now that I've figured out how to make tables, here is Bolam's data regarding the number of films portraying fictional presidents:
| Decade | Films | Notable examples |
|---|---|---|
| 1930s | 15 | Gabriel Over the White House, The President Vanishes |
| 1940s | 0 | N/A |
| 1950s | 5 | Project Moon Base, Suddenly |
| 1960s | 18 | Dr. Strangelove, Fail-Safe, Advise and Consent |
| 1970s | 23 | Being There |
| 1980s | 37 | The Kidnapping of the President, Splash |
| 1990s | 61 | Independence Day, Wag the Dog, Primary Colors |
| 2000s | 74 | 2012, etc. |