Badami was ruled by many dynasties and Chalukya dynasty was the main as they ruled the place from 6th century AD to 8th century AD.
Pulakeshin I of Chalukya dynasty found the city in 540AD and made it his capital. His son Kirtivarman I succeeded him and constructed the cave temples. Kirtivarman has three sons named Pulkeshin II, Vishnuvardhana, and Buddhavarasa.
He was succeeded by his uncle Mangalesha who also constructed the cave temples. Mangalesha was assassinated by Pulakeshin II who ruled from 610 to 642AD. He was a great king of this dynasty as he defeated many kings including Pallavas.
Pallavas captured Badami in 642AD but were later defeated by Vikramaditya I, son of Pulakeshin II, in 654AD. After that Badami was captured and ruled by Rashtrakutas and Hosayalas. Then it was included in Vijayanagar empire. Later Mughals, Adil Shahis, Marathas and British ruled the city.
Badami Caves from one to four are numbered in order of their creation. Though exact date of the construction is not known but the inscription found in cave 3 shows that this cave was constructed by Mangalesha.
The construction of cave one and cave two has north Deccan style while cave three has the styles of Nagara and Dravida. Cave one, two, and three belong to Hindu deities while cave four belongs to Jains.