When we were younger, we played a homebrew game of D&D that was Transformers' themed. I've since, occasionally, wondered, if an official game exists(ted). Does anyone know?
To the best of my knowledge, an official game has never been published. There are plenty of games out there whose design makes such stuff easy, though! You want to know about some of those?
EDIT: First one I thought of was Mechamorphosis, a d20 minigame published by Fantasy Flight Games in their Horizon line of such games.
EDIT #2: How dare I forget about Cartoon Action Hour?
Official? None I'm aware of.
Mekton II and Mekton Zeta, by R. Talsorian Games include transformable mecha which transition between any of a variety of forms, including humaniform, beasts, tanks, aircraft, tractor-trailer rigs... Roadstriker II is the Mekton II supplement for mini-mecha, and includes combiner rules; Mekton Zeta includes those rules either in the core or in Mekton Zeta Plus.
GURPS Mecha has a section on transformable mechs. I am not really familiar enough with it.
Mecha Hero was the Hero System Mecha game; it included rules for multiple forms. Vehicles use the standard multiform power in later editions of the Hero System (4th/5th/6th), and are easily built if the GM allows.
Not So Close
Battletech has LAM's, Land-Air Mechs, which transform between humanoid and aircraft forms only.
Palladium's Robotech has several transformable mecha, but no construction rules. Same for their Rifts game.
Dream Pod 9's Jovian Chronicles and Heavy Gear do have multiform rules, but they are not the primary focus of the games, and may or may not work well.
Traveller has walking movement design sequences for MegaTraveller, Traveller The New Era, Marc Miller's Traveller (T4), T20 Traveller's Handbook, and Mongoose Traveller. Whilst several mecha designs do exist, I don't recall any of them including multiform rules (and am fairly certain no official ones exist).
Either Hero System 4-5-6, Mecha Hero, or Mekton Zeta are the best bets, in my opinion, tho' Heavy Gear is good if you already play it or another DP9 game.
Why? Both Hero System and Mekton Zeta have rules which include beast-forms, vehicle forms, and transformation rules that work in the battle game mode.
GURPS Mecha is a pretty crunchy design system; If you already play GURPS, it's a good choice; if you don't, it's probably a very bad choice, as it entails learning both GURPS and the Mecha supplement, and the supplement is for GURPS 3rd Ed; 4th is the current edition.
Mekton II is long out of print; while Mekton II is the same basic engine, Mekton Zeta is available in PDF, is more robust, and has fewer special case rules.
I suppose about as close as anyone got that I know of was the Robotech RPG. While not about intelligent robots per se, it included mechanics for robots that could transform between modes and advanced weapons and I do know of people that used that as a basis for a Transformers-like game setting (with some modifications of course).
As part of their 'Saturday Morning' series, Crafty Games released an add-on for SpyCraft 2.0 called 'TransMechs', described in the GameGeeks review as 'Transformers with the serial numbers barely filed off'...
It has a whole set of extra rules for playing a shapeshifting robot, including the kind of gestalt robots formed by the Constructicons, robots with multiple transform modes etc. It also comes with a setting called The Garage, a black ops agency looking into the existence of robots hiding amongst us, some sample NPC Transformers and a few scenes that can be used to either introduce Transformers to an existing SpyCraft campaign, or begin a new Transformers-based campaign.
There was a 64-pager for Carton Action Hour (first edition) called Metal Wars. It doesn't appear to be available electronically, though. It was released during the time Z-Man Games was publishing CAH with Spectrum Studios.
Cartoon Action Hour 2 includes a series named Transbots, which is of the same style, although I'm not sure how similar it is to Metal Wars.
Battletech had the Land-Air Mechs. http://en.wikipedia.org/wiki/BattleMechs#Land-Air_.27Mech_.28LAM.29
And GURPS Mecha has a section on Transformable Mechs.
Again, very a tenuous link and not an official game, but the rules to build one exist.
Alchemical Exalted can be reskinned into kinda Transformers quite easily. An Alchemical is a constructed robot made of magical metals and infused with a spark of life from the captured souls of dead heroes.
All their powers are upgrades and devices built into their bodies that they can swap around in repair bays. Blasters replacing hands and transformation are an easy powers to take.
As they grow in power, they are upgraded into larger and larger beings. The biggest turn into cites (like Metroplex) and can spawn normal sized avatars to walk around and do things. Even better, where smaller Alchemicals get blasters as powers - these city sized beings get gun batteries.
As a bonus, they come from the inside of a mechanical god-planet. Their role there is to serve and protect humanity while they work to serve the god. Right now, though, the Gremlins are getting in and corrupting the faithful Alchemicals into nihilistic destroyers of their home. Sound familiar?