The direction of rotation is determined by the Coriolis effect. This effect is caused by the Earth's rotation and causes moving objects to be deflected to the right in the Northern Hemisphere and to the left in the Southern Hemisphere.
So, while both typhoons and hurricanes rotate the same way, the names are simply different conventions used for storms in the Pacific Ocean (typhoon) and the Atlantic Ocean (hurricane).