I always struggled with remembering how to get this as a kid playing through this game.
The area that opens after you hit the switch in the center of the slime is very dark. use your map to avoid getting lost.
To get the chain saw on level E1M2, NUCLEAR PLANT:
To the northwest of the level's starting point is a door that you'll need a red keycard to get through. Head west through this door, and take a right, down a short curved passage that leads to a small slime-floored room.
Look for a pillar in the center of this room and Activate the switch on its back side.
Leave this slime-floored room, and as you head back towards the red-keyed door, you'll see a newly-opened wall section ahead of you, located just south of the red-keyed door.
Walk into this new passage, down a few steps, and turn right.
Walk a couple paces forward and you'll see a wall edge, or partition, up ahead of you and a little to the left.
To the right of this partition is a single passage that continues off to the right: Ignore that path for now. Instead, walk to the first opening just to the left of that partition, and continue on in that direction, staying close to the right-hand wall.
Continue forward (west) and up ahead you'll see a barrel in the corner. Walk up to this barrel and turn left (south). You'll see a green armor jacket ahead of you on the floor against the wall. The wall panel right next to the armor is a secret door.
In SNES Doom, this panel can be opened like any regular door. In all other Doom games, use your fist, pistol, shotgun or chaingun to attack the panel, and it will open.
Enter this newly opened passage and follow the winding stairway up to a windowed area where you'll see the chain saw on a pedestal. A switch in the corner of this room will cause the pedestal to lower, allowing you access to the chain saw.
Compliment of http://www.classicdoom.com/pce1m2.htm.