The event was marked with the showing of a local play, traditional music and comedy performances for an audience of around 1,000 people.
The theatre closed in the early 1990s as Somalia descended into civil war and the capital became a no-go area.
The UN-backed government is trying to re-establish control of the city after al-Shabab's Islamists were forced out.
The al-Qaeda-linked group banned all forms of public entertainment, such as the theatre.
'Beauty of Somalia'
Jabril Ibrahim Abdulle, director of a Somali think tank, said the theatre's history reflected that of Somalis.
Mr Abdulle, who was one of the driving forces behind the opening of the theatre, told the BBC's Focus on Africa programme: "The theatre was absolutely devastated daily and that really mirrored the life of Somalis.
"We all killed each other enough - life has to move on, 21 years [of war] is enough," he said.
"People are saying if we can rebuild the theatre, we can rebuild our lives."
The opening shows at the Somali National Theatre will address issues of peace and reconciliation and look at what happened to the country over the last two decades.
In a sign of how far the country still has to go to achieve lasting peace, around six people died when a mortar shell fired by al-Shabab fell on a refugee camp in Mogadishu on Sunday night just a few hundreds metres (yards) from the theatre.
"People are brave enough to show up and enjoy themselves, despite the attacks yesterday, and that is the beauty of Somalia," Mr Abdulle said.
Somalia's President Sheikh Sharif Sheikh Ahmed has assured performers that the national theatre is an important part of attempts to revive the country's institutions and will remain fully functioning