>>280849491Well you typically paint or tag your nickname. Graffiti with it's vibrant colors, braggadocios and rebellious nature due to it being illegal, and being a completely new visual style of art served as a good visual representation of how the music sounded. It gained popularity at the exact same time as Hip-hop and so that's why its considered to be an element of it. Many people who listened to the music during that time also painted or wrote graffiti.
People forget that Hip-hop isn't just a genre of music there's a whole ass (sub)culture associated with it, at least in the beginning before it melded into general American culture. The "4 Elements" of hip hop are rapping/MC'ing, break dancing, DJ'ing, and graffiti, on top of dress, speech, philosophy (yes there are rules to hip-hop), and even arguably some foods and drinks (nobody was drinking 40oz of malt liquor before rappers rapped about it).