Scrolling through the results, I noticed that a youtube link was being shown, clicking on which a list of videos was shown, many of which I had actually watched.
This could be for a number of reasons. Without the link, it's impossible to verify what that reason could be. YouTube itself does not have a "what other people watched"-feature or anything similar.
However, one possibility could be that you added these videos to a public playlist on your YouTube account. In this case, yes, the videos you watched will have been associated to your YouTube account in a publicly accessible manner.
I consider this a very serious fact because, now many people who spy on me, think they know very well what I am looking for, and from this, they deduce my opinions.
Unless you run for a public office, most people won't care in the slightest about your political opinions. You could hold extremist views such as socks being a conspiracy theory or that the number 9 is used to spy on us, and very few people would care.
I would like to know what the reasons for this event may be, and if by chance it is due to a virus.
Without knowing exactly what you saw, no one can say for sure. However, what I can say for sure is that it was not a virus. This Venn Diagram explains it very well:

Google does not receive information from malware developers about what YouTube videos people search for, to display them when someone searches for their name. That makes no sense whatsoever. They run YouTube, they already know which videos you watch.
Also, I would like to know how to prevent this from happening again.
Again, without knowing what you saw, no one can make a concrete recommendation. Look at your YouTube public playlists. That's the most likely candidate.