if you replaced the trunk light as a direct for direct replacement (OEM bulb) and its not working, thats likely a fuse.
If it was working and its now not working and its not an OEM bulb, likely the bulb itself but could also be the fuse.
BMWs really dont like non-oem bulbs as the cars voltage system is very very finnicky.
(Ask me about this, i once replaced all the OEM bulbs with white light LEDs purchased as a kit), looked great and bright at first, but car was like a disco after a week, when the lights would pulse on and off- terrible, embarrasingly - I had to go back to stock yellow OEM bulbs).
If you checked the bulb and the fuse and both look okay, check the minimum voltage required on the bulb, sometimes you might get that voltage on startup/welcome but not thereafter, meaning you need a bulb with different operating voltage.
If you checked both and both are within spec, check then pin connectors for proper contact, some contact cleaner can help, or scrape inside carefully with a small flathead - sometimes a tiny bit of corrosion can occur inside and then poor contact, means intermittent light.