Welcome to the fest!
First off, that manual transmission switch is NOT for manually shifting the gears! It's strictly for locking the transmission in the gear it's presently in (such as 2nd) if you encounter poor traction. It keeps the transmission from up-shifting and then downshifting again when traction is regained. DO NOT push the "M" button and then run the car through the gears with the shift lever. BMW automatics are notoriously weak in the E36s, and manual shifting one will rapidly hasten it's demise. Read your owner's manual. The transmission should be operated in the "D" position or "3" for more rapid acceleration and then shifted into "D". Running it in "3" raises the shift points so the car has better acceleration.
For your problem, I'd say a fluid and filter change might help, but it really sounds like it may be a transmission computer problem OR the valve body misbehaving. The automatic transmissions in our E36s are French-built GM transmissions. Repair of them is pretty much beyond the ability of most of us. You need to have the transmission codes read by an independent BMW repair shop, or as last resort, a BMW dealership. By your description of the shifting, it is bound to have some error codes stored. Good luck.
Quotes to live by:
guessing gets expensive
nothing is more expensive than a cheap BMW
buying a ratty example (of a BMW) is a parasitic relationship.(and you ain't the mosquito)
Ken Kanne, Silverhill, AL, E36 & New Member Intro Forum Mod/Bimmerfest Tow Truck
1995 318is "Bebe"; 1993 325is "Elvira"; 1985 635CSi "Katja"; 1984 633CSi "Sylvia"; 1987 325is "Odette"