In the ancient Kingdom of Mahishmati in India, Sivagami, the queen (Ramya Krishnan), emerges from a cave adjoining a big waterfall, carrying a baby. She kills the soldiers pursuing her and sacrifices herself to save the baby by holding the baby up over the surface of the water while she herself drowns. Local tribal communities save the baby and tribal queen adopts him. She also gives him the name 'Shiva'.
Shiva (Prabhas) grows up to be a strong young man aspiring to ascend the mountain and makes many unsuccessful attempts at it. He then finds a mask of a girl which falls from the waterfall. Driven to find out the identity of the girl, he climbs the mountain again and succeeds this time.
On top of the waterfall, Shiva discovers that the mask belongs to Avanthika (Tamannaah), a rebellious warrior whose group has indulged in a guerilla warfare against king Bhallala Deva / Pallvalathevan (Rana Daggubati) of the Mahishmati Kingdom. The group intends to rescue their former queen Devasena (Anushka Shetty) who has been chained in the kingdom for the past 25 years. Avanthika is given the opportunity to rescue the queen.
Shiva approaches Avanthika while she is on her journey to Mahishmati. Although she is stubborn at first, Avanthika falls in love with Shiva after she finds out that he has climbed the waterfall for her. Shiva pledges to help her in her mission and sneaks into Mahishmati to rescue Devasena. Shiva rescues her and flees along with her but is chased down by the king's Royal slave Kattappa (Sathyaraj), known for his great warrior abilities. After Shiva beheads Bhadra (Adivi Sesh), Bhallala Deva's son, Kattappa drops his weapons on realising that Shiva is Mahendra Baahubali, the son of late king Amarendra Baahubali.
A flashback reveals Amarendra Bahubali's past. Amarendra's mother died while giving birth to him, while his father had died much before that. Sivagami takes charge of running the kingdom with Kattapa's assistance until a new king is elected. Amarendra Bahubali and Bhallala Deva are brought up together, trained in all areas including arts, science, disguise, politics and warfare, but both of them have different approaches towards kingship. Amarendra Baahubali is liberal to everyone but Bhallala Deva is violent and achieves his goals with any means possible, even trying to kill Baahubali.
When the Kalakeyas start a war with the Mahishmati, Sivagami promises that the new king will be the one who beheads the Kalakeya king. When it seems that Mahishmati would end up being defeated, Amarendra inspires his soldiers to fight to the death and they end up crushing the enemy. Despite Bhallala Deva being the one to kill the Kalakeya king, Sivagami announces Amarendra Baahubali as the new emperor because of his nobility and leadership in the war.
After the flashback, when asked about Amarendra's current whereabouts, a tearful Katappa reveals that the King is dead, and that Katappa himself is the one responsible for his death. The movie ends in a cliffhanger, leaving the viewer with a surplus of unanswered questions.