According to the American Meteor Society, the sonic boom of an asteroid or meteor (sometimes referred to as a 'fireball') is due to
If a very bright fireball, usually greater than magnitude -8, penetrates to the stratosphere, below an altitude of about 50 km (30 miles), and explodes as a bolide, there is a chance that sonic booms may be heard on the ground below. This is more likely if the bolide occurs at an altitude angle of about 45 degrees or so for the observer, and is less likely if the bolide occurs overhead (although still possible) or near the horizon.
And from CalTech's CoolCosmos page
When an object travels faster than the speed of sound in Earth's atmosphere, a shock wave can be created that can be heard as a sonic boom.
The reason for asteroids causing sonic booms in the lower atmosphere, is according to the article How the Falling Meteor Packed a Sonic Punch (Klotz, 2013) is due to
Because the meteor is supersonic, the waves, which travel at the speed of sound, can’t get out of the way fast enough. The waves build up, compress and eventually become a single shock wave moving at the speed of sound.
Looking a bit further in to what a sonic boom (Using a jet as an example) is and how it occurs is illustrated in the following diagram
So, if a meteor, asteroid is going faster than the speed of sound for particular part of the atmosphere, then a sonic boom will occur. Going back to the American Meteor Society's description of the likely cause of a sonic boom, they stated that if a meteor comes in
below an altitude of about 50 km (30 miles)
then a sonic boom is likely to occur, one of the reasons is that the speed of sound is slower, due to the temperature of the atmosphere at that height and lower. Below is a graph showing the speed of sound plotted against temperature as a function of atmospheric elevation: