A transistor generates no loss if it is in the full on or full off state (saturated). But every time a transistor switches from the on to off state (or back) it goes through its linear region. While in the linear region the transistor acts as a resistor and generates heat. If you increase the switching frequency the transistor switches more often and thus generates more heat.
The solution to this problem is to use more efficient transistors or decrease the switching time (the time it takes to switch from high to low, or back).
Of course higher switching frequencies also have lots of other problems such as radiation, skin effect, etc.