It has to do with the fact that water forms crystals when it freezes. The crystals, because of their shape, take up slightly more space than just the water molecule would.
It is, as you say, only for that rather small temperature interval that this happens.
You might also want to consider how important it is that water has this peculiar property of expanding rather than contracting just as it freezes! This is what causes freezing water to be able to crack rocks, eventually producing the soil that growing things need. If ice did not float, ponds and lakes would freeze from the bottom up rather than having a layer of ice on top so that fish and other lake creatures would be forced up, away from their food sources. That layer of ice also acts as insulation keeping the rest of the water from freezing.