Rooting just lets you go further inside of your phone, so you have complete control over software and hardware. It is completely safe for your phone and literally millions of people have their phones rooted or jailbroken.
You have a better chance of downloading a virus through a sideloaded app than by rooting your phone, since unlike the iPhone, you are not restricted to the App Store. Anybody can write an Android app and put it on the internet, Google nor anybody else has to approve it.
If you are worried about viruses, don't download apps unless it is a trusted source like the Marketplace. But there is no need to worry about rooting it.