The Ikhwan (Muslim Brotherhood) in Egypt has a very long history of cyclical ebb and flow in its relationship to the government. The government, since the 1950's a secular premiership, alternately tries to co-opt the MB and clamp down on them. It depends at least to some degree on how much of a threat the MB represents to the premier's monopoly of power.
But that co-opt/clamp down cycle is older than the Egyptian "republic" (i.e. the secular gov't dating back to the 1950's); it goes back a couple hundred years at least and they were a thorn in the side of the Ottomans and the British too (and all the various iterations of those who ruled on behalf of/with the tacit approval of the Ottomans).
For many of the same reasons that Hamas and other Islamicist groups have gained popularity in the Muslim world, the MB has as well. They tend to organize at the grass-roots level, they fill in the social, medical, and educational services vacuum that the governments are unwilling/unable to provide. They represent a system of values, tradition, and structure which deeply resonates with many in the population (especially in more rural areas) which the Arab secular governments have pretty much completely abdicated in favor of centralizing their hold on power. Their philosophies are "pure" in the sense that there is little room for modernity, for coexistence with the West (widely perceived as the root of all evil) or Israel/Jews, and their espousal of those philosophies (via schools, madrassas, Imams' homilies) are unfettered by the idea of compromise with "Infidels" or anyone doing business with "Infidels."
That doesn't make them the "good guys" although at face value it can seem that way to those who are disgusted with the western tilt in Egypt and other Arab nations -- namely Jordan. Their ideologies tend to be deeply violent and recidivist. Clearly in the case of Hamas there is no room for peaceful negotiation or coexistence with Israel. Such is also true with Ikhwan in Egypt (as well as Syria, but in Syria the massacre at Hama in the early 1980's of about 20,000 Muslim Brotherhood activists and their families by Hafez Assad more or less expunged them from threatening the Assad dynasty). They are also an issue for King Hussein in Jordan, and though the Wahhabi Saudi royal family is very "fundamentalist" in its Islam, the MB is also active (very much sub rosa there too (as well as the other sheikhdoms on the Arabian peninsula and in Yemen).