There is resistance in the metal of the plates and wiring, active plate materials, and electrolyte. The heat produced by this resistance is proportional to current squared.
In metals the resistance is caused by electrons 'crashing into' atoms as they move through the conductor, but in electrolytes entire molecules are moving. Electrolyte conductivity is strongly affected by ion concentration, so its resistance will increase as the battery is discharged and fewer ions are left in solution (those fewer ions must move faster to create the same current, and thus have more collisions which is seen as higher resistance).
Also the chemical reactions involved may be endothermic or exothermic. This occurs because the different bonds between atoms before and after the reaction may require more or less energy.
In a NiCad battery the charging reaction is endothermic, but the discharge reaction is exothermic. So when charging it actually sucks heat from its surroundings and stays cool (until it is full and the reaction finishes), while during discharge it produces heat and gets hotter than you might expect. NiMH batteries do the opposite - they get hot while charging, but cool themselves during discharge.
The other factor that must be taken into account is temperature. A 10°C increase can double the activity of ions in an electrolyte, which will cause its resistance to drop dramatically. As the battery warms up the heat produced by electrolyte resistance will reduce, slowing the internal temperature rise. However the reduced voltage drop also results in higher terminal voltage, so the load may more draw current (or the same, or less, depending on what type of circuit the battery is powering).
With all these factors having an effect, accurately calculating the rise in battery temperature during operation is not easy. You can get a resistance measurement by simply applying a step current and measuring the instantaneous voltage drop, but this value will vary depending on temperature, state of charge and current.