There're a lot of possible reasons. Some possibilities:
1) The reject review(s) are weak while the accept review(s) are strong. I once had a paper were one reviewer said "this paper is clearly wrong, if we accept this methodology one can prove anything, reject" without elaborating. The paper also had three other reviewers who all took the paper seriously and gave suggestions for improvements. At this point it's either trust the word of the first reviewer (bringing in secondary factors like seniority, publication record ...) or ignore the first review. I think most people will think the latter is more reasonable.
2) The reasons for rejection are not fatal. This is the most common reason. In the above example, suppose the first reviewer had gone into why the methodology is clearly wrong, and provided good reasons for it. In that case the paper is fatally flawed, and so rejection is obvious. On the other hand if the flaws can be corrected, then revision might be better. This comes down to the judgment of the editor, and different editors will react differently.
3) The journal lacks papers. The ugly side, but does happen. If the journal is having trouble filling its issues then it might be more inclined to send your paper for revision than reject outright. Conversely if the journal is receiving way more submissions than it needs, it might incline towards rejection. This is also when biases can play a role. For example, a journal could be trying to expand its author market to [X country]. If you're from X, then they might incline towards revision.
4) The editor had received confidential information. This usually leads to the second possibility (when the editor rejects even though reviewers recommend accept), but it's possible it leads to acceptance. There are two main sources for this: the "confidential comments to editor" box when writing a review, and the "please explain why you are declining to review" box.
5) The reviewer(s) might have a history of recommending rejection (or vice versa). Editors can see a reviewer's history of recommendations. If the reviewer has been recommending reject for most papers (including those that were accepted and went on to generate lots of citations), then the editor might put less weight on the review.
Ultimately, the job of the editor is to decide whether or not to accept the paper, and it's a judgment call. Just like different reviewers might have different opinions on a paper, different editors can also reach different conclusions.