The creation and expansion of European empires during the Age of Discovery resulted in the expansion of trade routes to new colonies and trading posts across the world. The vast areas of these trade routes were far larger than the new empires' navies could effectively police, which meant that merchant vessels moving along them were essentially responsible for their own protection. It also meant that pirates could establish bases that were, effectively, out of reach of the colonial powers. Expansion of the European world also resulted in greater "interaction" at sea with other world powers, much of which would be classed as piracy by the Europeans.
As a merchant ship owner of the time, you had to balance defending your vessel against making a profit from the voyage, e.g. the more guns you had, the larger the crew you required and both of those meant you could carry less cargo. Ships of the period were comparatively small and the cargo space wasn't all that large to begin with. This generally meant that trading vessels were far more lightly crewed and armed than any pirate vessel that preyed upon them.
Competition between the European powers during this period led to conflicts of interest which, in turn, often lead to full-scale wars. These were fought out across the oceans as well as on land. During the 17th Century European states were just starting to raise standing navies. Because of the cost, these were kept small and usually had to increase significantly in size at times of war. The number of available armed vessels were swelled by issuing letters of marque to merchant ships to act as privateers. In wartime, governments often overlooked the past activities of seamen and awarded letters of marque to men who were previously pirates (greatly blurring the distinction between pirate and privateer).
During times of peace it wasn't economical to maintain large fleets so most of the ships' crews were disbanded. The merchant and fishing fleets could only absorb a certain number of the released seamen, so the remainder had to find other employment. The alternative jobs on land were unskilled and, consequently, low paid making life as a pirate seem comparatively attractive. Thanks to their wartime activities, these men would have all the skills that they would need as pirates in hunting down and capturing ships. As a ship master (who was often the owner), if you had operated as a successful privateer during a war it may have been very tempting to cross the line and operate as a pirate once the war ended.
Life Among the Pirates: The Romance and the Reality, D. Cordingly (1995)
The Sea Rover's Practice, B. Little (2005)
Piracy: The complete history, A. Konstam (2008)
Pirates of Barbary, Corsairs, conquest and captivity in the 17th Century Mediterranean, A.Tinniswood (2010)