The company in charge of the Pniowek mine, JSW, said the first explosion took place shortly after midnight at a depth of 1,000 metres (3,280 feet).
There were 42 miners in the area of the blast and many suffered burns.
A second explosion occurred while rescue workers were assisting the victims of the first.
One of the dead is a rescue worker, Prime Minister Mateusz Morawiecki said.
"The words catch in one's throat because we now know that five people are dead and seven are still trapped inside the mine galleries," Morawiecki told reporters.
"There are also more than 20 people in the hospital with severe burns," he added, speaking on a visit to the mine.
Poland, which relies on coal for most of its power, has experienced several other mining accidents in recent years.
Two men were killed and two others injured when an underground wall collapsed at the southern Myslowice-Wesola mine last year.
In 2018, five miners were killed in an earthquake that struck the Zofiowka mine, also in the south.