Busking is technically not illegal. In fact, in many circumstances, prohibiting it is actually a violation of the First Amendment. However, there are a few small rules that must be observed.
If you are in a public place, like a park or a street corner, there are really no laws against you performing there. Some areas like Central Park may have designated “Quiet Areas”, but in general, the police can’t say anything unless you are disturbing the peace. So, if there’s a scheduled event right next to you, like a wedding or a charity event, it’s best to take your guitar and find a different venue. If you are planning to have a set audience of 20 people, though, you will need to get a permit from the city’s Department of Parks and Recreation.
Subway stations might be a bit of a different story. It is a public place, so there’s technically nothing stopping you from performing there. However, these are small, enclosed spaces where overcrowding and noise is an issue. As such, some police officers will ask that you don’t perform on the platforms or trains. The New York MTA offers several auditions every year for artists who want performance licenses, as part of their Arts for Transit program, so that’s definitely worth a look.
A lot of residential areas often have noise ordinance laws that prohibit you from playing. It’s also not a good idea to perform right in front of a business, as this often has the side effect of driving customers away. If a local resident calls in a complaint, the police may have a valid reason to ask you to stop.
Of course, different cities, and even different neighborhoods in the same city, have different laws about this, so it’s best that you do a bit of research first. Also, this should go without saying, but avoid getting arrested. It’s never nice to see a musician getting cuffed just for playing “Stand By Me” on a subway platform.