The word has a long and distinguished history, with the Oxford English Dictionary (OED) giving examples of its usage dating back to the 13th century. One of the early references is John Wycliffe's Bible (1382), Leviticus xxii, 24: "Al beeste, that ... kitt and taken a wey the ballokes is, ye shulen not offre to the Lord..." (any beast that is cut and taken away the bollocks, you shall not offer to the Lord, i.e. castrated animals are not suitable as religious sacrifices).
The OED states (with abbreviations expanded): "Probably a derivative of Teutonic ball-, of which the Old English representative would be inferred as beall-u, -a, or -e".
The Teutonic ball- in turn probably derives from the Proto-Indo-European base *bhel-, to inflate or swell. This base also forms the root of many other words, including "phallus".
From the seventeenth to the nineteenth century, bollocks or ballocks was allegedly used as a slang term for a clergyman, although this meaning is not mentioned by the OED's 1989 edition. For example, in 1864, the Commanding Officer of the Straits Fleet regularly referred to his chaplain as "Ballocks". It has been suggested that bollocks came to have its modern meaning of "nonsense" because clergymen were notorious for talking nonsense during their sermons.
In 1977, Professor James Kingsley, a famous linguistics professor at Nottingham University, had accredited the word to be used in the early eighteenth century with the Roman Catholic Church priests. His studies show that the actual word "Bollocks" means either a 'priest', or 'rubbish by the priest'. Often, there were priests in the early eighteenth century who generally spoke rubbish, which is how the term "Bollocks" began to be associated with rubbish. The conviction came from the fact that Professor James Kingsley himself was a reverend and had been doing linguistic history research all his life.