To me this looks like the first instance of space-tourism (humor, pls don't add the tag, see exemplary documentation at end of question). The astronauts landed next to Surveyor-3 on purpose, got out of their spacecraft, walked over to it, took pictures of each other next to it, collected a couple of souvenirs (for later study), packed up, got back in their spacecraft, and went home. OK they did do a lot of other things while there as well.
How did they know the location of Surveyor-3 with such precision, using 1960's technology? There was precious little extra fuel on the lander to fly around and look for it, so they must have had a pretty good idea how to navigate there and safely land within walking distance (~200m). How was Surveyor-3's location known to such accuracy?
below: From here.
Charles Conrad Jr., Apollo 12 Commander, examines the unmanned Surveyor III spacecraft during the second extravehicular activity (EVA-2). The Lunar Module (LM) "Intrepid" is in the right background. This picture was taken by astronaut Alan L. Bean, Lunar Module pilot. The "Intrepid" landed on the Moon's Ocean of Storms only 600 feet from Surveyor III. The television camera and several other components were taken from Surveyor III and brought back to earth for scientific analysis. Surveyor III soft-landed on the Moon on April 19, 1967.
below: Surveyor-3, cropped copy of From here.
NASA Image ID number: AS12-H-48-7121, NASA
Apollo 12 astronaut Alan Bean took this picture of the Surveyor 3 spacecraft on the second moonwalk EVA on 20 November 1969. Surveyor 3 landed on the Moon inside the edge of a small crater on 20 April 1967 where it took pictures and transmitted them back to Earth and performed soil mechanics experiments. The arm of the soil mechanics sampler is seen extended out to the right. The panels on top of the center mast are the solar arrays. The camera is the white cylinder just to the right of the mast. The arm extending upward to the left is the omnidirectional antenna. The spacecraft is just over 3 meters high. This view is looking to the north.
below: Examples of getting out of a transporting craft, walking over to it, taking a picture with it, and (presumably) packing up, getting back into the craft and going home, presumably having done other things as well.