British English, various regional dialects notwithstanding, encourages politeness and courtesy. A friend of mine from Scandinavia, living in the UK for over 15 years, whose language contains no direct way of saying please or thank you and who certainly would never use sorry to gain someone's attention for some reason, still has problems getting to grips with the myriad ways in which British English speakers use ten words where one will do.
In a strictly literal sense the extra words are redundant, but for a native speaker these are a requirement to show respect to the person you are addressing. Sorry in the sense you are asking about is one of these extra words. In this it is used as an apology, the first recorded use of sorry in this way was, according to the Online Etymology Dictionary, in 1834; while Sargent's New Monthly Magazine of March, 1843 contains the phrase "sorry I'm in such haste" [Oxford English Dictionary Online].
Much of the advice I have come across while looking into this appears to come from people who come close to giving their personal preferences as rules of use, with little reference to how native speakers actually use sorry in situations. On the forum.wordreference.com site one responder to exactly the same issue goes so far to as to say their advice "was consciously trying to steer a learner away from something I think wrong".
In actual usage, native speakers will use sorry as more or less interchangeable with excuse me and there is nothing wrong in this. Again, in a strictly literal sense, it is an apology for bothering someone. However, in certain circumstances (e.g. asking someone to get out of you way) it is an automatic, unconsidered request and has really lost any connotation of an apology.
The situations where you would use sorry are, though not invariably so, more informal than when using excuse me. You might say sorry to get past someone when shopping; excuse me to get past your boss at work. Other examples could be excuse me to gain attention at a lecture or work meeting; sorry for the same purpose with a group of friends down the pub (excuse me can be used in this situation to humorous effect, for example if someone says something you believe to be wrong). It is more likely that sorry, [where are the eggs?] will be used in a supermarket; while *excuse me, [do you have a first edition of 'Alice in Wonderland'?] would be used in a specialist book shop.
The British, amongst other faults we consider to be virtues, are adept at making judgements based on how a person appears (which is why, digressing shortly, someone begging at a railway station can make £100's a day when dressed in a suit, with a briefcase, claiming to have had his wallet stolen, while making nothing when dressed casually). When stopping someone in the street to ask directions we judge, often without thinking, whether they rate sorry (probably casually dressed and around our own age), excuse me (likely to be dressed more formally but still probably around our own age), or even excuse me, please (likely to be dressed more formally, or in a casual suit, and older than ourselves).
To make matters more complicated, as if that was necessary, in some contexts the addition of please after excuse me is more or less de riguer. Especially this is the case when trying to get past someone (so excuse me, please).
Further, excuse me can be made more informal by using the colloquial 'scuse me, (please) or 'scuse, (please). The Urban Dictionary describes this variant as the "ill-tempered short-mannered way of saying, "excuse me”" and as "more rude and assertive" than excuse me. As a native British English speaker I disagree with this, for practical purposes it can be thought of as more or less interchangeable with sorry.
This may give some idea of the vagaries of English, and the mantraps strewn about in seemingly casual exchanges. It is, however, true to say that some, at least, of the above is becoming less important due to the globalisation of cultures. It is also true to say that my friends describe me as old-fashioned so much of this may be out of date when we get to the 20th century :-).