There is a figure showing the location of the Lunar Guidance Computer LGC within the LM. See page GN-11 in the PDF. Similar figures here (1) (figure 3.2-3 on page 40 or 3-7),
(2) (figure 2.1-1 on first page 2.1-1).

The LGC needs connections to the DSKY, the Coupling Data Unit, the Navigation Base and many more other units. Therefore its best place is within the pressurized cabin of the LM in the ascent stage. It is used for ascent and descent, mounting it to the descent stage is not possible.
Placing the LGC outside the pressurized cabin would require several additional gas tight connectors mounted to the cabin walls. To keep it as simple and reliable as possible, these additional connectors should be avoided.
The Landing Radar Antenna (lower right of image) is used for descent only, its best place is at the descent stage near a landing leg.
From this page: "The LGC (with related equipment) was mounted behind the astronauts at the back of the LM cabin. In front of the astronauts was a rigid structure called the "Nav Base" that held an alignment telescope and the Inertial Measurement Unit (IMU) in a fixed geometrical relationship. The computer's Display and Keyboard Unit (DSKY) was mounted like a desk between the two astronauts."