Samurai hated guns, calling them "cowards' weapons"
Hollywood, along with the general public, has come to view the samurai as sword-wielding heroes of an age long gone. Guns just don't fit into our picture of that; therefore, samurai must not have used guns.
In fact, the Japanese were using guns more effectively than their European counterparts by the sixteenth century, as well as producing more accurate, durable varieties. The battle of Nagashino, where guns tore through charging samurai cavalry, is one of the most famous and influential battles in the history of the samurai. The samurai were not stupid; in fact, they were renown for their adaptability. The Mongolian invasion, Chinese royal culture, and enterprising Western powers all influenced medieval Japan at one time or another. In fact, the kimono, one of the most famous symbols of Japan, came from China during the Heian period. It was no different when the Portuguese introduced a devastating new weapon called the arquebuse (or teppo, in Japanese). No matter how much the samurai loved their bow, they weren't oblivious to the fact that the gun obviously outclassed their previous artillery choice. Several forms of guns were used, from the general old-fashioned musket-like gun we tend to think about, to large hand cannons, to even the rare full canon (which were generally taken off of crashed European ships). They were all used with devastating efficiency. One of the greatest daimyo (general/feudal lord) of the Warring States era, Oda Nobunaga, was well renowned for his brilliance with gunnery tactics. Others, such as Takeda Shingen, Tokugawa Ieyasu, and Date Masamune were also well known for using snipers, entrenched artillery, and sometimes just mass amounts of gunners, with devastating results..
Some believe that because foot soldiers (ashigaru) were the primary users of guns the samurai must have detested them. Instead, the ashigaru were simply too disposable to teach them anything more complicated. This didn't mean that samurai were not also taught how to use guns; in fact, they were generally taught more in depth. It is also notable that, of the honors granted in battle, the one granted to a gun unit was surpassed only by taking a head in individual combat.
This information comes directly from the Kitsuno, the Forum Shogun at the Samurai Archives. A great source for information about the samurai and other aspects of Japanese history prior to the Meiji Restoration.