Moats are deep, wide ditches filled with water. They were usually built near sources of water that flowed into the moats, filling them with water. The moats were filled with water for a few reasons. It made enemies swimming across the moat easy targets. It also made it impossible for enemies to dig underneath the castle walls, which was a common method of attack. It also prevented fires from destroying the castle. 
The word moat comes from the French word motte, which means hill. Moats were first used in the Medieval period, from 1066 to 1154. Castles were built on the top of high hills. The area at the bottom of the hill was eventually called the moat. 
Castle moats were usually between 3 and 30 feet deep, and they were not always filled with water. Not all moats contained water, as a simple dry, wide ditch could prove an obstacle. These were called dry moats.