I agree with scottalexander. A slightly weak battery will make an e60 do all sorts of weird things. I also agree about changing transmission fluid. Get a manual and be sure you have the right tools and test gear. Fluid change is all done under the car. The draining is obvious, big drain plug in the bottom of the pan. Filling is dune thru a smaller plug up on the side of the case. Be sure you can open the fill plug before draining, sometimes they don't want to open. Our cars are xdrive so I remove the front drive shaft to access the fill port. Yours will be easier. Use the right fluid. It will be dark when it comes out, new fluid is almost clear. DOn't worry unless it is black or stinks like it's burnt. You have to pump fluid in. Expect 6 Liters.
Get a good manual, it helps. I bought the Bentley and it has paid for itself. You will also find a ton of YouTube demonstrations.
I did the valve body on one of ours. I replaced the square rubber seal, the mechatronic electrical connector seal and also the little tubular ones between the valve body and the case. I also replaced the solenoids since I was in there. The car drives like new now.
Thectsc.com is a great source for parts and fluid, by the way. I have also found fluid on amazon from Ravenol that meets the spec.
These transmissions are built tough, a lot tougher than most, but they do get weird if not maintained.