---------------------------------------------------------------------------=
-Sounds like you have the switch 'across' the battery?
So when the switch is ON it short circuits the battery which won't last very long and will be ruined.
The battery gets hot because of the excessive amount of current it is trying to put out. If it's a typical 9 volt (transistor) style battery it is only designed to provide a few milliamps (a few thousandths) of an ampere. A short circuit will ruin the battery very quickly. Although the chemicals inside that make the electrcity may recover slightly.
It appears that the circuit is mis-wired. Note.
With a more powerful battery (say a 12 volt car battery) by the way a 'short circuit ' like that could cause a fire. If you are interested read up on "electrical fuses".
Note: Most often a switch goes 'between' the battery and the item to be powered. When the switch is OFF no electrcity flows. When the switch is ON electrcity flows 'through' the switch to the item being powered.
email me if I can be of any help