This answer seeks to build off of both Enkidu and Iconoclast's, there will be repetition here, and I just wanted to say that upfront.
For many younger people from Western Europe and North America the punk scene was their first introduction to ideas such as anarchism, thanks, in no small part, to the likes of the early UK anarcho-punk bands such as Crass having taken seriously the Sex Pistol's calls for "anarchy." Strangely enough, some of the members of Crass were former hippies, who were already familiar with libertarian thinking thanks to their experiences throughout the 1960's.
Punk was a reaction to the conditions of the 1970's, recession, widespread unemployment, and, probably most importantly, a rock and roll pantheon that had become increasingly disconnected from audiences. In many ways, it was a rebellion against the peace and love ethos that had failed in the '60's, but at the same time was carrying on the rejection of mainstream culture. Punk helped revitalize the british anti-nuke movement, and more recently can be pretty much directly blamed for the very existence of crimethinc (I don't mean that as anti-crimethinc, necessarily).
As far as an actual connection to anarchism, many punks are anarchists, and many anarchists like punk music - it can be irreverent, challenge authority, and encourages a DIY mentality and informal networks and mutual aid between small touring bands, promoters, and zines. However, punk (and I definitiely came to anarchism by way of punk, and still like punk) is not and should not be synonymous with anarchism. At it's worst, punk is about consumerism (beer, drugs, records) and spectacle (outfits, hairdon'ts, shows), while lacking real substance. Most punks I know feel contented to buy records or write songs railing against the system, often with little analysis of their role within the system, and often to the exclusion of any meaningful confrontation of power itself. Punk can often be sexist, homophobic, and exclusive (then again, so can anarchist circles). Punk can be Oi Polloi or The Ex, or it can be Green Day and The Exploited.
In the end, punk can be a platform for spreading ideas and propaganda, but it should not be the only platform, or even the most important one.