Selim Khan, the information secretary of the Dhaka City North unit of the ruling Awami League's youth front, was detained near Balaka Building next to Shahjalal International Airport around 5:15pm on Friday.
Airport Police Station's OC Noor-e-Azam said the pistol found on Khan was licensed.
"He has been detained because no-one is allowed to bring gun to any programme of the prime minister. There were also two bullets in the gun," he said.
The aircraft carrying the prime minister from Dubai landed at the airport at 6:42pm. She stopped at Dubai on her way back from the US, where she attended the UN General Assembly following another conference in Canada.
The leaders and activists of Awami League, its partners in the ruling coalition and the affiliates lined up along the street from the airport to her official residence Ganabhaban in the afternoon to welcome her.