Q:

Why didn't they launch the Falcon Heavy to be injected into Mars orbit?

With SpaceX's mission of getting a human colony, why would they launch the roadster into  the astroid belt and not actually attempt to inject it into mars orbit?

A:

The time didn't line up right, and the payload didn't meet planetary protection standards. The nearest launch window opens in June of this year. MAVEN will take advantage of it. To actually go to Mars, it would have to meet planetary protection standards, and I don't think a used car would qualify.
What they did instead was to demonstrate they could go to Mars, if they launched at the right time. This, however, was not the right time to do so.
In addition, it would have required a whole lot more complex of a satellite to achieve orbit, including propulsion capability, deep space tracking, solar power, attitude control, and more complex stuff. That would bring the cost from maybe a million to tens of millions of dollars for the payload. And it would look much less like a car.

A:

The trip to Mars takes a long time
Entering mars orbit isn't a single burn activity, once you get near you must do at least one more burn to enter that orbit
The rocket engine requires liquid oxygen
The current design of the second stage rocket (and first stage, incidentally, but irrelevantly) does not include sealed oxygen cells.  They continuously vent gaseous oxygen so the pressure inside the cell doesn't exceed its design capacity
The oxygen fuel would have been depleted by the time the second burn was required

So to enter mars orbit you need to have a second stage that is designed to use fuel that doesn't vent so later orbit injection burns can happen once the rocket nears the final orbit.

