I understand that he accepted money from the United States for the Aswan Dam, but why then did he sign the Czech Arms Deal in 1955, which basically meant he was working with the Soviet Union?
What advantage was their to gain from being neutral?
Modified from an earlier answer
"Working with the Soviet Union" is a somewhat inaccurate way to characterize the diplomacy in this period. Nasser used foreign aid as a means to keep Egypt both independent and turn it into a regional power. Therefore he always tried to exert some control over the scale and distribution of this foreign aid. Egypt's connections with the USSR had far less to do with ideology and more to do with the geopolitical context of the 1950s and 60s. Nasser's strategy boiled down to the superpowers off of each other for better assistance packages and eventually the USSR won this race in the 1950s.
There were a number of reasons for this Soviets victory. Firstly, Nasser's explicitly anti-colonialist rhetoric meshed well with the Soviet's strategy of trying to win over the decolonized world. An important plank in the USSR's public diplomacy was the explicitly anti-colonialist nature of Marxist-Leninism. To have Nasser as an ally would have been a great boon to the Soviet's image as Nasser enjoyed great popularity throughout the Third World, especially after the Suez Crisis. There was also a sense among the Soviets that winning over a figure like Nasser would let the sails out of its emerging ideological rival for the Third World: Mao Zedong. There was also a more quotidian rationale for the Soviet's winning over Nasser in that they needed Nasser far more than the United States. For the Soviets and the Eastern bloc nations, these trade deals and other connections were a means to get both resources and diplomatic recognition. The Egyptians exchanged cotton to finance the Czechoslovakian arms deal, and in an Eastern bloc planned economy a scarce resource like cotton could be a huge boon. The US's containment policy sought to erect diplomatic cordons around the Eastern bloc and use soft power to restrict trade to the Eastern bloc. In the case of the GDR, the West German government held the position that it was the sole sovereign German state until such time that there could be a proper treaty settling Germany's borders, thus the East German governments often held out lucrative trade deals as a means to get full recognition within the Third World.
The Egyptian-Soviet relationship was relatively one-sided and Nasser resisted any attempts by the Soviets to use aid as a lever to control him. Nasser suppressed the Egyptian Communist Party and created a de facto single party state. Nasser also kept his diplomatic options open especially among the other nonaligned leaders like Tito and Nehru. The US never really made a formal break with Nasser, and this gave him leverage against the Soviets as he could do what Sadat did in the 1970s and exchange patrons. Nasser also kept a very tight rein on the Soviet military advisers operating in Egypt. As an officer in the Royal Egyptian Army, he had experience with British military advisers using their position as essential components of the regime's strength to assert control over the Egyptian king. Nasser was determined that such a state of affairs was not to repeat itself. While he would in his speeches laud the Soviet's public commitment to anti-colonialism, he would often warn that the Soviets too were a foreign power and the new Egypt would not tolerate any foreign intrusion onto Egypt's national sovereignty.
Sources
Alexander, Anne. Nasser. London: Haus, 2005.
Kyle, Keith. Suez Britain's End of Empire in the Middle East. London: I.B. Tauris, 2011.
Westad, Odd Arne. The Global Cold War: Third World Interventions and the Making of Our Times. Cambridge: Cambridge University Press, 2005.