If a mechanic told me I needed a new engine, I'd get at least two more opinions. I think you just got water somewhere it should not be. I had water once get past a torn spark plug boot on my Porsche and I had similar symptoms. It's possible moisture in an electronic component could cause problems. Someone needs to read the codes as a starting point. I would be very surprised if a defunct engine would not cause the SES light to come on and you never mentioned that it did. I agree with Timfitz,hydro lock could be a possibility. Get several opinions from knowledgeable mechanics.
1979 Porsche Tobacco Metallic 911SC
1996 Porsche Guards Red 993 C4S
2005 Porsche 996 Turbo S
2003 BMW Ti Silver M5
2013 BMW X3 35i Carbon Black M-Sport