He didn't change his mind. He lied to get elected. His team knew exactly what message to hit, riding the wave of anti-Republican / anti-George W. Bush sentiment, to win the election. Obama is a politician above all else, and a scoundrel; but then I repeat myself [hat tip Mr Twain].
Normal people get confused by how a politician's brain works. Typically a person holds a set of beliefs, and attempts to follow those whenever they reasonably can. They have a code of morality, knowingly chosen or absorbed by default, and they try to be good, most of the time. Politicians do not function that way professionally. Work life Obama is not private life Obama. A voter sees what they think is a normal person when they vote; there's nothing normal about the business life of a politician. The really talented ones hold every belief simultaneously, and switch when it's required. With the only restriction being the party ideology; and the only variable within that being the strictness of adherence (it's the same game of ideological flexibility, just played within the party's limits).
In this day and age, to aspire to the Presidency, you're either a psychotic power luster capable of any lies and misdeeds necessary to win the office, or you're an ideologue willing to fall on the sword. The former usually wins.