On a 1989 Jeep Cherokee (XJ) with the 4.0L 6-cylinder engine, the Engine Control Module (ECM), sometimes called the Powertrain Control Module (PCM), is typically located
under the hood, near the passenger side firewall. It's often mounted to a bracket or secured to the inner fender well in that area. It's usually a fairly large, rectangular electronic module.
However, the exact location can vary slightly depending on options and specific build. It's best to consult a repair manual specific to your 1989 Jeep Cherokee 4.0L for the precise location. A visual inspection in the area described above should reveal it.