The rocket attacks had been around since 2001, but got much worse once Israel pulled out of Gaza in August of 2005. This was a peace gesture that backfired. From 2001 to 2005, about 700 rockets were fired from Gaza into Israel. Since the 2005 withdrawal over 3,400 more rockets were fired into Israel. The rate of firings increased after Hamas took control of Gaza in June, 2007.
Hundreds of trucks full of goods enter Gaza from Israel each day but it is Hamas that refuses to allow more. Many more trucks enter via the one legal route from Egypt and Hamas restricts the number coming here as well. All this is to enable Hamas to collect more taxes (from goods smuggled through the tunnels) and get weapons and wanted criminals (as in Islamic terrorists) into Gaza. The tunnels also allow Hamas to move whatever they want in or out of Gaza without any government interference or observation.
The tunnels under the 14 kilometer Egyptian border employ over 15,000 Palestinians. Hamas deems them legal enterprises and charges a large fee (over $2,500) for anyone who wants to build and operate a tunnel. No one is sure how many smuggling tunnels there are under the Gaza-Egyptian border. During the last two decades, frequent outbreaks of Palestinian terrorism have led to the border being closed. A security fence between Gaza and Egypt made above-ground smuggling difficult, so the Palestinians began digging tunnels and using them to smuggle people and goods into, or out of, Gaza.
Israel and Egypt long cooperated to identify the tunnels used to move rockets and other weapons into Gaza. Egypt passes information on to Israel and then these tunnels are shut down with an Israeli air strike (sometimes using a penetrating bomb, if needed). But most of the tunnels are left alone, so consumer goods can get into Gaza and the Egyptian border force can continue to extort bribes from the tunnel operators. Egypt is keen on shutting down the weapons shipments because Hamas is also sheltering Islamic terrorists who focus their attacks on Egyptian targets. But most of the goods moving through the tunnels are consumer items and Egyptian politicians have refused to shut these down. This is partly because it would be bad publicity and partly because the tunnel operators pay a lot of bribes to Egyptian officials.
When the Israelis ran Gaza (up to 2005), they got pretty good at finding and destroying tunnels. The Egyptians, who took over control of their border with Gaza after 2005, are nowhere near as good and they can be bribed. But in the last year, as Islamic terrorists based in Gaza have been caught making attacks in Egypt, more of the Gaza tunnels have been shut down. But not all of them, and those that still operate give priority to bringing in weapons.