It is essentially a portable meal. Tradition claims that it was originally made as lunch for Cornish miners unable to return to the surface to eat. In such pasties commonly meat would be at one end and a fruit filling at the other. A related tradition holds that it is bad luck for fishermen to take them to sea.
Oggy is a slang term for a Cornish pasty, see Oggy Oggy Oggy.