In the US, we imagine that we live in a society where social mobility is always possible. The rags to riches story of the poor kid who ends up making millions (usually as a sports star) is treated as almost normal, whereas of course it is wildly unusual. Few people these days make great leaps of upward social mobility.
But it's possible. It was also possible in the Middle Ages, even though even more unlikely than it is now. Upward mobility was generally a several-generations-long process, and of course downward mobility was also possible, and generally much faster.
For a peasant, upward mobility generally meant becoming a more well-to-do peasant, through careful use of one's limited resources, very hard work in the field, and some raw luck. A young peasant (generally male) might also move to town in the twelfth century or later, trying to make his fortune there, although the ones who actually made a "fortune" were extremely few.
Among the townspeople, someone willing to work very hard (and who got a lot of raw luck) might become fairly wealthy as the head of a merchant or banking house or as a guild master. He (or occasionally she) would try to emulate the nobility, wearing silks, educating his children, eating meat. No one would actually mistake a wealthy merchant for a nobleman, but there were enough of these by the late twelfth century that some in the lower nobility felt threatened.
For downward mobility was also possible, and a lord who overspent on silks and spices, rebuilding his castle, going on Crusade, and acquiring new land could find himself in danger of having to do his own plowing.
Marriage was a way to give upward mobility to one's children. A wealthy townsman could hope to marry the daughter of a knight down on his luck. A knight would hope to marry a castellan's daughter, a castellan a viscount's daughter, and so on up the line. (Note that men hoped to marry up, women had to deal with marrying down.) A knight could not marry a princess (no medieval gender-swapping equivalent of the pretty waitress catching the billionaire's eye), but within about five generations everybody in the upper levels of society was related to everybody.
One of the best routes to upward mobility was the church, although one had to have at least a decent social background to begin with (few peasant children entered the church, as their parents couldn't spare their labor, and serfs couldn't enter the church at all). That is, a person from what we would call a middle-class background could become in effect a prince within the church as an abbot or bishop.