The study of complex political phenomena such as parties' polarization calls for mathematical models of political systems. In this paper, we aim at modeling the time evolution of a political system whereby various parties selfishly interact to maximize their political success (e.g., number of votes). More specifically, we identify the ideology of a party as a probability distribution over a one-dimensional real-valued ideology space, and we formulate a gradient flow in the probability space (also called a Wasserstein gradient flow) to study its temporal evolution. We characterize the equilibria of the arising dynamic system, and establish local convergence under mild assumptions. We calibrate and validate our model with realworld time-series data of the time evolution of the ideologies of the Republican and Democratic parties in the US Congress. Our framework allows to rigorously reason about various political effects such as parties' polarization and homogeneity. Among others, our mechanistic model can explain why political parties become more polarized and less inclusive with time (their distributions get "tighter"), until all candidates in a party converge asymptotically to the same ideological position.