This study is looking for patients who have been diagnosed with advanced non–small cell lung cancer (NSCLC) that have certain biomarkers (negative for PD-L1, and positive for KRAS p.G12C). This study is being conducted to determine how well participants respond to treatment with chemotherapy (carboplatin and pemetrexed) combined with either sotorasib or pembrolizumab. The study will determine whether sotorasib and chemotherapy reduces the risk of this type of cancer getting worse and improves participants survival (i.e., increases the chance of you living longer) compared to the current standard treatment with pembrolizumab and chemotherapy. It is anticipated that participants will be enrolled in this study for approximately 5 and a half years. There will be a total of approximately 15 visits to the study site during the study depending on how well participants tolerate or respond to the study drug. The visits will take several hours each and will take place approximately every 3 weeks.