Traffic congestion is one of the major challenges faced by daily commuters in smart cities. An autonomous transportation system with a 5 G-based Cellular Vehicle-to-Everything (C-V2X) communication system is the solution to meet the traffic challenges faced in smart cities. Vehicular networks provide wireless connectivity to enable a large number of connected vehicle applications. Vehicular networks allow vehicles to share their emergency and infotainment traffic by following vehicle-to-vehicle (V2V) or by using vehicle-to-infrastructure (V2I) communication. The infrastructure of vehicular networks mainly comprises multiple Road Side Units (RSUs). Fog computing nodes are placed adjacent to these RSUs to provide quick access to vehicles. For infotainment traffic, vehicles intend to download their required content from the content provider. Caching the same contents from the nearby fog computing node significantly reduces delay with improved quality of service. As there are millions of contents with varying sizes, caching all demanded contents on these fog nodes is not possible due to their limited caching capacity. In this work, we propose an improved content caching scheme for fog nodes to satisfy vehicles and content providers for fair content placement. The proposed algorithm is based on a modified Gale–Shapley technique that considers factors such as content popularity, vehicle connectivity, and quality of the communication channel to optimize the content caching process. Simulation results show that the proposed technique caches a higher number of popular contents with lower downloading time.