My new used BEEMER! 1999 528i

My1999 BMW 528i has "honking " noise when I turn the engine on and put it in drive,usually when idling. I don’t hear it just going down the road. It’sounds like mule braying under the hood. Maybe a pump? It doesn’t do it whenI take the car out of gear,like put it in park.