Screenwriting is the act of creating specialized written text to be presented as a directed storyline specifically for the film medium. This "written text" is commonly referred to as a screenplay.
Most screenplays are written to be a purely audio/visual presentation, and tend to focus more on what is seen (action) and what is heard (dialogue). Dialogue is of utmost importance in a screenplay, and traditionally, the script is divided into three "Acts" (beginning, middle, and end). In addition, the screenplay also serves as a directional tool for the filmmaking process, guiding filmmakers and actors through a storyline.
[It is important to note that although the term "screenplay" is often connected to television, it's cousin the "teleplay" is a more appropriate term for that medium.]
...It is also important to note that without the screenplay, actors would be purely street or stage performers and filmmakers would continue to be waiters, busboys and bartenders. (filmmaker Ed Wood might be the lone exception)
As long as there has been creative filmmaking, there has been screenwriting and screenplays.