Water purification, or to make water safe for drinking and cooking generally falls into two steps:
Water Filtration – the process of removing chemicals, particulates and some types of microbes and bacteria. There are many products on the market for this process, such as this Dual Ceramic Water Filter Bag. You can also learn to improvise filters with natural materials, such as a Sand Filter.
Water Disinfection – the process of killing of any remaining microbes and live bacteria to render them inactive. Read some great techniques for this here.
Both processes can potentially make water safe on their own, however when feasible using both ensures the best quality and safest water possible.
It is important to note that neither process is guaranteed to make any water from unknown sources or condition completely safe. Both methods have limitations so it is best to start with the best quality water you can get, and then use both processes whenever possible.