Yes, it's possible. You can do it with a system plugin.
However there is already a such solution available by Regular Labs. It's called Advanced Template Manager, and it works similarly to the Advanced Module Manager (if you have ever used it).
Advanced Template Manager is an extension that changes the way your
Template manager works.
With Joomla you can normally only assign template styles to certain
menu items.
With Advanced Template Manager you have the possibility to assign
template styles to just about anything you want, giving you full
control over your Joomla template styles.
Not compatible with...
Advanced Template Manager is NOT compatible with these (and maybe
other) templates and template frameworks:
Gantry (RocketTheme)
JoomlaXTC
T3 (JoomlArt)
Warp (YooTheme)
If it happens to use one of those non-compatible templates/frameworks, it could still be possible to develop your plugin and handle this, but it will take some research to find out how these frameworks deal with their template styles.
This is a basic frame of what you should do in your system plugin:
public function onAfterRoute()
{
$mobile_template_name = 'your-other-template';
$app = JFactory::getApplication();
// only run in front-end
if (!$app->isAdmin())
{
$selectedCategories = $this->params->get('categories');
$input = $app->input;
// run for articles
if ($input->get('option') === 'com_content' && $input->get('view') === 'article')
{
// get article model
JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_content/models', 'ContentModel');
$model = JModelLegacy::getInstance('Article', 'ContentModel');
$article = $model->getItem($input->get('id'));
// find current article catid
$catid = $article->catid;
if (in_array($catid, $selectedCategories))
{
// article is in the selected Categories, so Set your other template
$app->setTemplate($mobile_template_name);
}
}
}
}