Say for example a person gets an email with a link. That link turns out to be a download link for a virus and once the user clicks on it the virus is installed on his computer. Sure the virus is on his computer but what makes it run. If the user doesn't open the virus file there is nothing to run it? So how do hackers take over your computer if you never even ran their virus?
In addition to @mentallurg ‘s answer there’s another way of executing the virus code. Sometimes virus code is packaged within an exploit for existing software.
For example there could be a vulnerability in your browser that allows constructing a malicious web page in such way that a part of that web page would be interpreted as code and executed on your cpu. Depending on vulnerability used that could happen right after you open the page, or when you perform specific actions (like clicking something) within the document.
The best way to defend against these attacks is to regularly update software. In addition - minimize usage of weird browser extensions (flash, silverlight, etc). Browsers are pretty secure pieces of software, but flash is regularly used as a target. Nobody should use it in 2020...
Normally virus are spreaded not as pure virus code. One of ways is that the file that user downloads is a normal application like text editor, video editor or some utility. The executable code (e.g. .exe or .msi) contains the application code and virus. User downlods such file to use the application. And to use it, user course launches it. The virus code is the activated. How successful the virus will be depends on the antivirus installed on the system.
If user doesn't run such file, of course nothing happens and virus is not activated.
Many antiviruses check the data received from Internet on the fly and normally do not allow to store infected files on the disc. But in case virus was not recognized and browser saved it to the disk, happens what I described.