Spray foam insulation works by mixing the two chemical isocyanate and polyol resin together. Both the can and the gun carry out this function and provide a medium for transferring it to where you want to use it. However, each have their own pros and cons that, depending on your preferences, could determine which type of spray foam insulation sprayer you would like to use.
The gun and the can essentially do the same job. However, the gun shoots the foam more quickly, powerfully, and in a way that is more accurate than the can.
Price and Storage
The can, however, can be found at a price as low as $12 whereas it is difficult to find a spray gun for less than $100. The gun is more work carrying around, whereas the can is convenient for carrying, as well as storage.
A consequences of using both the gun and the can is that if any of the foam material is left in them, it hardens inside of it. If you are doing a small job, it would be advisable to buy the can in case foam hardens inside of it rendering it useless. This is not such a bad deal if you only bought a small can rather than a large, expensive gun. There are ways to clear the gun through a process called "purging,' which is useful for when you intend to spray foam large areas. However, this could add much more to your work load going through extra efforts to preserve your gun when you only intended to complete a small job.