The specifics of how the Terminator got close to Connor are never mentioned. However, from the dialogue in the film we can assume that the Terminator was able to approach Connor because of his outward appearance. SkyNet knew that John had an emotional attachment for the 101 model because of the events in "Terminator 2". Knowing what we do of the Resistance and their operations, it's also safe to assume that the Terminator could have only approached Connor with his permission. Therefore, we're probably looking at one of the following scenarios:
- The T-850 allowed itself to be captured & presented to John.
- The T-850 was captured and/or damaged and then John went to see it once he learned it was a 101 model.
- The T-850 managed to infiltrate the human headquarters and got within visual range of Connor, at which point Connor allowed him to get closer because of his outward appearance.
The third option is most likely, based on the T-850's dialogue in the quote below:
JOHN: Why didn't I send you back?
T-850: I am not authorized to answer Your question.
KATE: Why didn't he send you back?
T-850: He was dead.
KATE: Well, that sucks.
T-850: Humans inevitably die.
JOHN: Yeah, I know.
JOHN: So how does it...? No. Maybe I don't want to know.
KATE: How does he die?
T-850: John Connor was terminated on July 4th, 2032. I was selected
for the emotional attachment he had for my model due to his boyhood
experiences. This aided in my infiltration.
JOHN: What are you saying?
T-850: I killed you.
It's safe to assume that no one else in the Resistance (except for possibly Kate, depending on which timeline we're discussing) knew what the 101 Terminator looked like. Therefore we must assume that John himself saw the Terminator at some point and reacted as SkyNet expected he would. When he lowered his guard (by letting the T-850 enter the facility, or get closer, or whatever), that's when the Terminator made its move.
For more information, see the following on the Terminator wiki (Thanks go to Richard for the link):