Welcome!
Are tehre any other markings on the engine? Is there a VIN?
Anyhow, using the seven digit you provided on this site:
BMW VIN Decoder - By Mitsuhiko Kanekatsu, it tells me that that the car was:
Series E24
Model 635CSi
Body type coupe
Catalog model ECE
Production date 1985 / 01
Engine M30
Transmission Automatic
But I can't know if the number that you found actually corresponds to the VIN of teth engine from c=which it came off. It may just be a coincidence that BMW happened to make a vehicle with taht serial number.
Good luck. It sounds like you've made a nice find.