A computer virus is a computer program that can copy itself and infect a computer without permission or knowledge of the user. However, the term "virus" is commonly used, albeit erroneously, to refer to many different types of malware programs. The original virus may modify the copies, or the copies may modify themselves, as occurs in a metamorphic virus. A virus can only spread from one computer to another when its host is taken to the uninfected computer, for instance by a user sending it over a network or the Internet, or by carrying it on a removable medium such as a floppy disk, CD, or USB drive. Meanwhile viruses can spread to other computers by infecting files on a network file system or a file system that is accessed by another computer. Viruses are sometimes confused with computer worms and Trojan horses. A worm can spread itself to other computers without needing to be transferred as part of a host, and a Trojan horse is a file that appears harmless. Both worms and Trojans will cause harm to computers when executed.
When The programming on computer began in 1950's, workers in Jon von Neumann's company started to write programs that destroyed others programs. and this was considered as a game and whoever destroys the more number of other's programs is considered as the winner. This is the start of the virus.
Nowadays arent that much prevalent. But trojans and worms are more prevalent these days. The Trojan tried to instal itself in your computer and gathers ur personal data such as ur creditcard details and other info and send them to some unwanted sites. These data can be misused
To prevent your computer from virus and trojan it is better to install a proper anti virus utility and /or spyware removal utility. It is often better not to double click on unknown applications.