Sultan Muhammad Quli Qutub Shah,the 5th Qutub Shahi ruler built Charminar in 1591 shortly after he had shifted his capital from Golkonda to what now is known as Hyderabad. He built this famous structure to commemorate the elimination of a plague epidemic from this city. He is said to have prayed for the end of a plague that was ravaging his city and vowed to build a masjid at the very place where he was praying. In 1591 while laying the foundation of Charminar, Quli prayed: Oh God, bestow unto this city peace and prosperity. Let millions of men of all castes, creeds and religions make it their abode, like fish in the water. Today one can see the city as evidence of the prayer being answered. The masjid became popularly known as Charminar because of its four (Farsi and Udru char = four) minarets (Minar (Arabic manara) = spire/tower), which was possibly was to honour the first four caliphs of Islam.
This beautiful colossus in granite, lime, mortar and, some say, pulverised marble, was at one time the heart of the city. Initially the wonderful monument with its four arches was so proportionately planned that when the fort was opened one could catch a glimpse of the bustling Hyderabad city as these Charminar arches were facing the most active royal ancestral streets. There is also a legend of an underground tunnel connecting the palace at Golkonda to Charminar, possibly intended as an escape route for the Qutub Shahi rulers in case of a siege, though the exact location of the tunnel is unknown.
Source : Wikipedia.com