It exists because the original settlers of America were persecuted for their religious beliefs. The Puritans were essentially ostracized from mainline Anglican Christianity. The new government didn't want religious persecution to happen again, just after having moved thousands of miles away to get away from it. Freedom of Religion makes plenty of sense when you consider that for most of history, all peoples were religious.