While graffiti exists since humans discovered how to make marks on rocks (think prehistoric caves), the style of urban graffiti that most people have seen and know about came from New York City in the late 1960s. Modern graffiti was born on subway trains:
A 17-year-old boy worked as a messenger and traveled all throughout the city. While he did so, he would use a marker and write his nickname, Taki 183, wherever he went: on walls, at subway stations and also on the insides and outsides of subway cars. Eventually, he became known throughout the city as this mysterious figure. In 1971, the New York Times was eager to find out the meaning in the message ‘Taki 183’, and a reporter found and interviewed the boy behind this tag. Kids all over New York, realizing the fame and notoriety that could be gained from "tagging" their names on subway cars began to copy Taki 183. Having your name/tag in as many places as possible was the goal, and the amount of graffiti on trains exploded.
Why on subways? A building is static. It doesn’t move, and it not very exciting. Tagging a subway car can be dangerous, and your graffiti gets to travel across the entire city. The fast motion makes the graffiti come alive, and it also has the positive meaning of ‘movement’, ‘direction’, and ‘going forward’. All this is hard to achieve on walls and static building. As the goal is to have a tag seen by as many people as possible, subway cars were the perfect way to gain exposure and visibility.