Star Trek fans might remember the "prime directive," the guiding principal that was (supposed to) prevent interference.
International space agencies have their own version of the prime directive.
Past missions such as Apollo and Galileo as well as each of the completed Mars missions, such as Pathfinder, the Viking landers, Observer, the Global Surveyor, Climate Orbiter and Mars Observer, made use of these procedures. Current missions such as Cassini-Huygens (currently studying Saturn its moons), the Hayabusa comet sample return mission, as well as all of the current Mars missions also follow the same method.
These procedures were created when Apollo 12 retrieved several pieces of the unmanned Surveyor 3 spacecraft. Surveyor 3, built in a non-sterile environment years before these procedures were in place, sat on the lunar surface for 2 1/2 years, exposed only to the cold of the moon’s negligible atmosphere. Analysis on the ground initially pointed to bacteria in a piece of foam inside a TV camera, but was later discredited by further study which pointed to sample contamination once the mission had returned to Earth.
The effort got planetary scientists thinking, and in 1967, the United Nations included a provision to "avoid harmful contamination of space and celestial bodies" in the Principles Governing the Activities of States in the Exploration and use of Outer Space, Including the Moon and Other Bodies.
NASA's Office of Planetary Protection manages NASA’s compliance. Procedures include constructing spacecraft in specially designed cleanrooms. While many RTP-based companies have smaller versions of these rooms for their manufacturing and R&D efforts, spacecraft are built in supersized versions at NASA facilities in Maryland and California. These rooms include an entire wall of air filters. Spacecraft and other equipment are even placed in the room according to their cleanliness requirements. The cleanest air is closest to the air filters.
Even the natural outgassing that occurs with many materials in manufacturing is taken into consideration in these cleanrooms. Think back to your last new car. What normal people call “new car smell” and find pleasant, planetary scientists call “outgassing” and find contaminating.
The scientists and engineers working in these cleanrooms must adhere to these processes as well. They enter dressing rooms through an air shower, blasting away stray dust and dead skin with compressed air. They must dress head to toe in protective suits, affectionately called “bunny suits." Men with beards and/or mustaches must also cover them to keep surfaces pristine. Even the bottom of each shoe is cleaned as people step on sticky mats located at each doorway. Any equipment or tools brought into the cleanroom undergoes a lengthy cleaning process.
This is even taken into consideration when ending missions. After the Juno probe finishes it's science mission around Jupiter, it will be purposely crashed into the planet, burning up in the gas giant's heavy atmosphere. This decision was made in part because the spacecraft will have been sufficiently fried by Jupiter's magnetic field to no longer be useful, but also to avoid hitting any of Jupiter's 66 moons, a few of which are of particular interest to scientists looking for evidence of life.
While there is an element of protecting some unknown life form from interference by a human created lander, rover or human mission to a planet or moon in our solar system, there are more scientific and even practical purposes behind these procedures.
Finding significant evidence of life, particularly organic life, outside of our Earth would arguably be humankind's most important discoveries. The last thing the scientists and engineers that have devoted their lives to making these missions possible want to see happen is having results questioned because of their procedures for that or any future mission. In short, if the spacecraft isn't kept clean of "Earth stuff," how can we be sure that something cool found on some other planet or moon isn't just something we brought along from Earth?
Also, getting anywhere interesting, even low Earth orbit requires going very fast. Spacecraft orbiting the Earth are traveling at over 17,000 mph. Any contaminants are also going that fast and if dislodged could punch a hole in another spacecraft or even astronaut.
Keeping our newest spacecraft clean helps protect existing ones, and their crews.