As a teenager, Hirayama attended Kunimi High School in Nagasaki Prefecture. There, he won the All Japan High School Soccer Tournament in all years bar 2002. He is the tournament's top scorer, with 17 goals scored between 2001 and 2003, with his school participating in all three years of his high school days. After graduation in 2004, he enrolled at University of Tsukuba.
In July 2005, Hirayama joined the Eredivisie club Feyenoord on trial and a week later, he joined another Dutch side, the newly promoted Heracles Almelo. He made his professional debut with Heracles on 20 August 2005 against ADO Den Haag, playing 15 minutes and scoring 2 goals.[1] He finished the 2005–2006 season with 31 appearances and 8 goals. Although both Japan's senior side manager Zico and Japan Football Association chairman Saburo Kawabuchi praised Hirayama's progress with Heracles, he was not called up to Japan's squad for the 2006 World Cup. On 4 September 2006, after the transfer period ended Heracles Almelo announced that Hirayama left the club by mutual consent and after being released he returned to Japan to finish his study.[2] Only a few days later he signed a contract with FC Tokyo without informing Heracles as a free agent, while he still had a contract until 2008 before his release. Heracles appealed to this unexpected move by Hirayama.[3]
Hirayama debuted in J1 League on 30 September 2006. After debut, his opportunity to play increased and he became a regular player from 2009. At 2009 J.League Cup, he scored a goal at Final and the club won the champions. However the club was relegated to J2 League end of 2010 season. In April 2011, he also broke his leg and he could only play one game. In 2012, the club returned to J1 League, however in May, he broke his leg again and he could hardly play in the match. From 2013 he played many matches as substitute. He moved to Vegalta Sendai in 2017. However he got hurt on the day after the opening game. He could not play for the injury in this season. In January 2018, he announced his retirement for many injuries.
His debut for the senior team came on 6 January 2010 in a 2011 Asian Cup qualification against Yemen, and would be a game he would never forget. After 30 minutes, Japan were down 2–0, but Hirayama scored a hat trick to help Japan to a 3–2 victory. It was the first time in 80 years and the second time overall for a Japan player to score three goals on his debut. Takeo Wakabayashi last managed that in 1930.[4] He also played at 2010 East Asian Football Championship in February. He played 4 games and scored 3 goals for Japan in 2010.[5]