Despite the depiction of Jesus as having long hair, it's most likely that he actually wore it short. There are numerous depictions of contemporary Jews that sport a short cropped hairstyle in Rome and Syria. Paul himself wrote in his letters that men should not wear long hair.
The most likely origin of the modern depiction of Jesus is the 6th century. Before, artists depicted Jesus with a lot of different hairstyles, mostly because the Bible does not describe him physically. One of the possible explanations for the long hair is that it was based on the iconography of Roman gods. He was to replace those atop the Olympus, so he looked like them: bearded, mature and with long hair.
A more specific reason has to do with Neptune. He is often depicted with long hair that merged with the water in his depictions. This symbolized the connection between Neptune and the water. Due to a few of Jesus' miracles having to do with water, some historians think artists adopted the long-haired look.