A mere 20 years ago, if a high school or college student was required to write a research paper, it meant spending time pecking away on an old-fashioned (by today's standards) typewriter. Those typewriters were limited to a single typeface — there was no drop-down list of five dozen fonts to choose from.
Which is why, if you read style guides and textbooks written before the 1990s, you will be directed to underline the titles of books (as well as movies and magazines). This was simply because, if you were using a typewriter, that slanty italic text simply wasn't an option (though it posed no problems for professional printers). Instead, you would type the name of the book, and then use a backspace key to return to the beginning of the title and add underscores to underline it.
As home computers became more common, and printers and word processing programs became more complex, the ability to italicize (and boldface and underline) text became widely available. The style for student writing quickly shifted to match what was done by professional publishers, which is to italicize book titles. Today, the underscore is rarely used in printed text, and then it is most commonly used to add emphasis.
The older underline style for book titles still exists in proofreading and copyediting marks, though. Writers, editors, and proofreaders — when they aren't working on-screen — indicate that text should be italicized by underlining it.