Excellent question! It all comes down to the chemical make up of water – two hydrogen atoms attached to one oxygen. Without going into too much detail, the shape and combination of these atoms makes water very ‘polar’ – meaning it has a weak positive charge on one side and a weak negative charge on the other. In the same way that the opposite poles on a magnet attract each other, opposite charges also attract each other.
This means that water molecules stick to each other really well, meaning it’s a liquid at room temperature. They stick together through something called ‘hydrogen bonding’ – essentially each hydrogen atom in a water molecules is attracted to the oxygen atom of a neighboring water molecule
The reason why it expands when it freezes is related to this ‘hydrogen bonding’. When the water is a liquid, these hydrogen bonds are constantly forming and breaking, giving a really random arrangement of all of the water molecules relative to each other. When the water freezes, the hydrogen bonds stop being broken all the time, and all of the molecules ‘line up’ in a really ordered structure. This ordered structure of ice takes up more room than the random structure of water, which is why water expands when it freezes! There’s a pretty good picture of it here:
The ‘polarity’ of water is also why it’s really good at being able to support life. Many of the chemicals that we rely on (for example salt – sodium chloride) are also really polar, just like water. Polar chemicals ‘like’ other polar chemicals – that’s why salt dissolves really well in water.
You’ve probably seen that oil doesn’t mix with water? That’s because oil is ‘non-polar’ – it doesn’t have any positive or negative charge anywhere on it. The water can’t ‘stick’ to it, so it can’t dissolve it, leaving the oil floating on top!