Why don't I have to refrigerate store-bought baby food but have to refrigerate home-made purees?
Shelf-stable wet foods in cans, jars, plastic pouches, and the like are generally sterilized by heating them under pressure, to the point where literally every microorganism that might be inside dies. The containers need to remain sealed to maintain the sterility -- verifying the seal is the purpose of the little "pops up" button on the top of jars which are processed this way (the processing leads to low pressure inside the jar, so a popped-up button indicates that the seal has been broken.)

If you have a pressure canner, it's entirely possible to make and can (well, jar) your own baby food. There's a variety of online resources describing how to do this. (I advise ignoring any which aren't on a domain ending in .edu or .gov; this is not something you want to follow amateur youtube advice on.) Note in particular that it is not possible to safely can baby food using just boiling water; you need special equipment.