To prevent is to take action directed at keeping something from happening. To avoid is broader; you can avoid something by preventing it, but you can also avoid something just by not being in the same place where it is occurring. Avoid is also used for physical obstacles, e.g. fallen tree branches in the road. To extend the example, one would prevent tree branches from falling in the road by trimming the trees near the road, so they don't have branches likely to fall. One avoids tree branches in the road by driving around them.