Get category name by product id magento
$product = Mage::getModel('catalog/product')->load($_product->getId());
$cats = $product->getCategoryIds();
foreach($cats as $categoryId) {
$category = Mage::getModel('catalog/category')->load($categoryId);
echo $category->getName();
}