If you are referring to the person riding in the front seat, the term originated from the days of the stagecoach, were the person next to the driver carried a shotgun against robbers, indians and wild animals.
Riding Shotgun - 2012 V is rated/received certificates of: Australia:MA
Old stagecoaches had two people sitting on top of the carriage. One was the driver, the other carried a shotgun to defend against Indians and bandits. Riding beside the driver is riding shotgun.
"Riding shotgun" means sitting in the front seat of a car. Before a car journey, if you are quick, you can call shotgun and you get to sit in the front seat.
Riding Shotgun - 2013 was released on: USA: 4 October 2013 (Woodstock Film Festival)
Greensburg Kentucky
The cast of Riding Shotgun with Jack McConaha - 2005 includes: Jack McConaha as himself
Lots of people use the term shotgun as a reference to ride in the front passenger seat. It is a game that we play when multiple people are riding in a car and are not the driver.
Riding shotgun?
Lawman - 1958 Riding Shotgun 1-29 was released on: USA: 19 April 1959
In the Old West of the US, stagecoaches carried passengers, freight, mail and money- and could be robbed. The driver sometimes had a guard that rode beside him on the seat, who was armed- usually with a shotgun.
They would call him simply the shotgun rider in old western times if it had valuable cargo based on the shotgun usually carried by this person. That's where the term "riding shotgun" came from when referring to passenger seat in a car besides the driver.