As previously identified its a CCV hose from the Cam cover. All these pipes and hoses, plastic and rubber need to be intact, no holes or splits otherwise air will be sucked in and mess with your fuel trims and affect the cars running. High fuel trims when looked at in live data with your scanner is a big clue to having air leaks between the engine side of the Maf across the engine and ending at the exhaust sensors. If leaks can't be found visually a smoke test will find any that are present.
Replaced all mine using a set from ebay, all fitted well and still ok after 18months, loads of sellers at various prices here
https://www.ebay.co.uk/sch/i.html?_from=R40&_trksid=p2380057.m570.l1313&_nkw=BMW+Z4+E85+CCV+Hose&_sacat=0
The ones under the intake are difficult to fit and you may have to take the inlet manifold off to get at the valve body and the hoses under there.