Nikon D5100 with SB-24?
The built-in flash is firing when a flash unit SB-24 is attached on my Nikon D5100.
But on page 202 of reference manual (D5100) they said "The built-in flash will not fire when an optional flash unit is attached".
What I'm doing wrong? Is there any issue to take into account this situation?
If it is firing in the folded down position then you definitely have a fault!
The SB-24 is a 20-25yr old unit - are you sure it is 100% compatible?
The SB-24 is not an i-TTL flash, and does not communicate with the camera other than X-sync (when to fire). If the 24 has manual control, or an "auto" setting, it can be used that way, but it is not TTL capable with your camera.
This means that you must use the camera in manual mode to make it work properly. That will also prevent the pop-up flash from coming up and firing.
Take the dang camera out of full auto. Use full manual, at any shutter speed 1/200 of a sec or less.