In The Merchant of Venice, before the play opens Antonio has a long history of speaking out against Shylock in public meetings and denouncing his practices. He also has a long history of carrying on a personal vendetta against Shylock by subjecting him to habitual insults and slurs. In Act 1 of the play, Antonio gives just a sampling of his habitual behavior in the encounter between himself and Shylock while Bassanio is attempting to strike a deal for the loan of three thousand ducats.
While Antonio is being insulting and demeaning of Shylock at the same time that he is asking to borrow money (not wise behavior, don't try it at your bank..), Shylock is being more and more offended. He finally agrees to loan the money but Antonio has driven him to seek revenge by asking for an absurd guarantee of the loan: If the loan isn't paid back in full in three months time, then as a forfeiture fee, Antonio will be delivered of one pound of flesh by Shylock.
Shylock's intention is revenge. In his soliloquy, Shylock declares that when offended, a Christian's first reaction is revenge. He then uses rather weak reasoning to say that if what the Christians give is revenge, then what the Christian will receive from him will be revenge (that is sort of like if your enemy jumps off a cliff, you jump off a cliff...).
Shylock probably didn't expect his intention for revenge to come to fulfillment; everyone in Venice expected Antonio's ships to make it safely to harbor. Shylock finds himself defeated in his intention because the Duke is horrified at the terms of the contract, which has to be confirmed in the court of law (just like broken contracts have to legally upheld today) and because a Venetian law prohibits threatening or endangering the life of a citizen.