What does a hard drive do inside a computer?

it is a memory device that writes to or reads from "files". To the user a hard drive is just a memory kind of like a file cabinet. you could write a new document and file it away, or you read from an index and pick the file you want to read.
its called a hard drive because of the evolution of computer equipment over the past 100 years or so. At one time it was common to use magnetic tape or use a steel drum or steel tape. when the PC computer first came out everything was centered around the floppy drive, which was a thin flexible disk inside a square container, it would hold up to 1Mb of data. If you were lucky enough to have an internal disk drive, $500 for a 20Mb drive, documentation seemed to separate the two by saying the floppy drive and the hard drive. Thats probably how the term stuck. today its probably hard drive and dvd drive and USB flash drive.

Also there is RAM memory that exists in tiny circuits, its fast but when power goes off the information is lost. a hard drive writes information that stays when power is off.

What a hard drive does is store a computers information in a pre-defined file format