The President is elected by the people, what you call popular vote I believe. The President then nominates the Prime Minister from whatever party holds the majority in the Parliament. In this election, it isn’t the presidential party that got the majority, so Attal (the exiting Prime Minister from the presidential party) resigns.
Macron could also resign I guess, since it was his idea to dissolve the Parliament in the first place, but it’s pretty uncommon.
Note that this is for the French system. Starmer is British and has to deal with whatever dumbster fire of a system they have on his side of the Channel