1) The guilds had their roots in a particular institution of Northern Europe, the Free city. Northern Europe was largely unique in that in the beginning it's cities were not seats of political power nor even particularly military hard points. This contrasted sharply with the experience of southern Europe and most of the rest of the world in general.
Instead, a group of traders and craftsmen would either build a settlement on some unwanted piece of ground e.g. the entirety of Holland, or they would petition the local nobel who militarily controlled the region for a spot of land. In the early and middle medieval periods trade and crafts, while necessary where only low single digit contributors, at best, to the overall economy, so the nobles didn't care. Neither did the nobles understand or care to understand business or trade. Instead, for a fixed fee in taxes, the inhabitants where granted "liberties" more akin to the modern concept of "privileges", and allowed to build a city and govern themselves.
This independence was symbolized by the "Keys to the City" which the inhabitants could use to lock the noble out if they so choose. Giving someone the keys to the city was a ritual of deep trust and respect.
An entire network of trading and crafts cities sprang up all governed internally by the founding inhabitants and their descendants and settling mutual disputes by the lex merchator, or "merchants law" probably histories only non-violence based legal system.
Price-fixing seems to be a hardwired into human economic behavior because it shows up in all cultures and in all times. The idea that there is a "fair" price for every exchange that can be determined by reason long before an exchange takes place, crops up eternally. Inevitably, all those doing the same work in the same city, which were small towns by our standards, would collude to set a "fair" price and exclude any competition. These price fixing systems on the part of craftsmen evolved into the Guilds. Within a few generations, such price fixing became seen as a positive right of those in the Guilds and those who undercut the fixed price tantamount to thieves.
They weren't all bad. They provide training, trademark protection, social welfare support, legal protection and political representation for their members. Although, their customers paid for those guild beneifts by the fixed price premium on work only the guild could provide.
Guilds, merchant cartels and commercial organization in the medieval era in general is very interesting because the nobility jealously garded their own monopoly on legal violence, so the guilds and other similar organizations in the beginning enforced their dictates largely non-violently by shunning and boycotts (although in a time when even the upper middle class spent most of their income on food, such non-violent acts could be lethal if they went on long enough.)
It wasn't until the end of the lex mechator when the nobles noticed how much money was rolling around and decided cut themselves in on the action, do you see guild price-fixing enforced by judicial or ad hoc violence. Commercial law and criminal/political law, once entirely separate, the first private the latter of the state, got folded into a single, violence enforced system. At that point, challenging the guild meant challenging the State. That's when things really got ugly for century or so circa 1450-1600
2) Guild rank was complex affair and depended on the craft. As with all things pre-corporation, lineage played a large role. If you dad was high up in the Guild, you probably would be as well. Politics played a role as well and as noted by Sammuel Russel, you often effectively had to have a minimum level of capitalization to set up a formal shop in many cities.
But compared to the rest of society of the time, Guilds were powerfully merit driven especially in highly technical, high stakes fields like shipwrighting, masonry or international trade. Lineage, capitalization and political skill could only get you so far if your boats sank, your buildings collapsed or you couldn't close the deal hundreds of miles away form all your political pull.
Further, the power of guilds was sharply limited by the boundaries of their "liberties" usually the extent of the city walls. By the 14th century it became common for those who couldn't get or stay in a city guild to just take the risk to set up shop just right outside the walls. The cities were "burbs" so the ad hoc settlements became "sub-burbs" (Yep, "urban sprawl" is over 600 years old and is still driven by the same basic political and economic dynamic.)
This limit on the guilds authorities meant that the driven and talented could escape guild control and rise on merit. It was not uncommon for a poor but talented orphans to rise on merit in many fields. Since success and money heal all wounds yesterday's scofflaw guild buster could be tomorrow's Master.
Further driving merit, those already high up in the field always needed skilled fresh talent coming in at the bottom because that talent was eventually their own wealth.
Especially in the highly physical trades like blacksmithing, Master craftsmen desperately needed skilled underlings because under the harsh use of their trade, their bodies simply broke down. Most men of that era where broken with repetitive motion injuries by 50 (a problem faced by third world craftsmen still.) In the finer trades like gold smithing, inevitable far-sightedness around the same time could in a career. (In the Wealth and Poverty of Nations, David S. Landes argued that spectacles gave Europe and overall economic boost by extending the working lives of key craftsmen by up to 20 years.) The goal of every craftsmen was acquire skills, then apprentices, then journeymen and build up capital and a sustainable shop so that in the last 10-15 years of his life, he could put down his tools when his body gave and largely train and manage until he died.
It was all well and good to prefer family over strangers, those of the right ethnic group, region, religion etc but if you needed someone skills to keep a roof over your, those concerns faded into the background. That allowed a relative weakening of the barriers to merit advancement within and certainly without the guilds.
It's kinda of easy to see why those within guilds so jealously guarded their price fixing privileges. With the threat of age or accident always looming as threat to the entire family, the thought of giving up fixed prices and their largely guaranteed income must have been terrifying. Conversely, one can see how those outside the guilds, bitterly resented the privilege and the poverty it often forced on outsiders despite their merit.