All e53 have pretty much the same equipment "hole" in the dash but some shipped with a CD Player and MID combo, while others had a full NAV screen system. If you have a MID cable in there and your aftermarket stereo is wired to audio cables in the dash (no long extension to an audio unit in the boot/trunk), your car likely had a CD Player and MID from the factory.
The MID has a row of buttons and the display indicates what each button does in each mode - to enter the code, the buttons are numbered 0-9.
Here's an older thread discussing the same issue as you have. The missing images in one of my posts are these these: -