When using the File item in Moodle, you can it is possible to control what happens when a student clicks on the link to the file.
...
Automatic: Moodle attempts to select the best method for the file
Embed: Open the file within the Moodle course page (if possible with this file type)
New Window: open the file in the current windowa new window/tab (if possible with this file type)
Force Download: download the file and stay on the existing page in the web browser
Embed: Open the file within the Moodle course page (if possible with this file type)
New WindowOpen: open the file in a new windowthe current window/tab (if possible with this file type)
...
To change the behavior of the file item, go into Edit Mode and Edit Settings then edit the settings for the file item. Under the Appearance section, change the Display option.
...
Some files, such as Microsoft Word documents, cannot be opened may not open in a web browser and will download no matter which option is selected. Some Conversely, some types of files, especially text-based files such as computer programs, may always open in the web browser. For these files, Force Download may be more appropriate.
...