my last 320i did the same thing when I was changing the spark plugs. I disconnected the Battery and the ECU plug to erease the faults and to clean it from the dust while I'm replacing the park plug.
When I finished fixing the new spark plugs, I connected everything ( battery, ECU plug). and try to torn on the car. but it's just caranking..and it's not working. I tryed until I got frustration.
I taked it to a work shop of very coool man

. What he did??
1st - he chaged the ECU by another = not success.
2ed- He changed the Air flow meter by another of 7 series!! just for try.
then he start working in this erea. He disconnect the air mass from the air box and unplug the cable also, then started spilling some fuel in it and let it go inside the manifold to reach the celenders, while the another guy trying to crank it.They keep doing this 3 - 4 times , then my car start waking up and work little by lettle with black smoke comming from back exhust , and loud sound like vroooom ( I like the sound

), they keep pressing on fule pedal to keep it working and heat up until it start working a little bit normaly!!!

.
then he fix back my Air mass. and was working better.
When I asked him about the exact prolem. He said " I dont know, just dont try to play in your car boy. I'ts working and you can go"!!
Me: What about mony?!!
He: Mony!!... Ok give me 50 S.R ( 13$ only )

.
So I think It just the Ecu or Air mass hanging or sleeeping and need something to wake it up .