I believe that usually the maker of the brand name product either pays a fee, or provides free items to use in the movie, in order to have moviegoers see their products. It functions as advertising.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.