We can make a side-by-side comparison. Considering only how the US President vs the UK Prime Minister are chosen, and simplifying over some details.
The UK has 650 constituencies, the USA has 51 states (including DC).
Voters in each constituency or state vote for their preferred party.
The party with most votes in a constituency gets one MP for that constituency. The party with most votes in a state gets all of the multiple electors for that state, known as "winner takes all".
Constituencies are supposed to all have the same number of voters, though it's not exact. States obviously have different numbers of voters, and smaller states get more electors per person, which is deliberate.
The party with most MPs or most electors gets the Prime Ministership / Presidency.
(Of course a big difference is that in the UK the MPs that choose the Prime Minister also form the House of Commons. In the USA you vote for the President and for Congress separately.)
The varying number of possible voters per MP or elector isn't the main reason the winner of the overall popular vote might not win the election. Rather it's about the distribution of votes. A party can win narrowly "where it counts" and lose big where it "doesn't matter", meaning they get the most MPs or electors despite not getting the most votes overall. It happened in the UK in 1951.