You should be fine with 5W30 although there should be a recommendation on the oil cap as to what grade is factory recommended.
I would go with a 10w-30 if your living some where were it is warm.
Make sure it's sythetic. That year of BMW specifies that.
Looking for a Used 5 Series in your area?
CarGurus has 15,046 nationwide 5 Series listings starting at $2,499.
Search BMW 5 Series Questions
BMW 5 Series Experts