Here’s a typical UPC symbol from a box of Hefty trash bags:

You can see that UPC is made up of 12 numbers. We’ll ignore the first and last numbers for now and just pay attention to the middle 10 digits.
The first five digits are assigned to one manufacturer. These manufacturer numbers are centrally managed, assigned, and sold by Global Standard One, or GS1, a non-profit organization. GS1 was formerly known as the UPC Code council.
Once a company is assigned a UPC code it’s up to them to assign the last five digits to their products as they choose. The company then informs GS1 of these product code assignment and GS1 adds them to its master database which is made available to third parties, like your local grocery chain to do look ups at their cash registers.
A UPC code is really a pointer to a record in the GS1 data base. The description and price are returned from the database lookup.
One interesting thing about UPC is that there are two different symbol patterns that encode each number depending on if it’s on the left or right side of the symbol. Look at how the number three is encoded differently on the two sides of this symbol:
This was done to allow omni-directional scanning with early supermarket scanners. These were often just a couple of laser lines that intersected at 90 degrees, like a plus (+) sign. Because the numbers were encoded differently on the left and right it allowed scanners to read the symbol a half at a time and put it together before transmitting. Each half of the symbol is taller than it is wide (oversquare) so it’s guaranteed to completely pass through one of the laser lines in a single pass.