Bassanio and Antonio are best friends and , as such, Antonio would do anything to help his friend. Bassanio has recklessly spent any funds he may have had and has therefore "disabled mine estate"(I.i.122) and knows of Portia who is wealthy and must choose a suitor in terms of her late father's will. Bassanio wants to present himself as a possible suitor so needs Antonio to lend him money to improve his chances and make him appear sufficiently wealthy.
Antonio insists that Bassanio must tell him why he needs the funds and agrees to help him to win Portia but is unable to lend him money himself as it is all tied up in ships that have not yet reached port. However, Antonio is secure and confident that his ships will return and so agrees that Bassanio should borrow money from Shylock, "the Jew." He tells Bassanio to "try what my credit can in Venice do" (180) so Bassanio asks Shylock to lend the money to Antonio, who despises Shylock - the feeling is mutual.
Even though it goes against his code, Antonio will borrow money from Shylock who he asks to "lend it rather to thine enemy" (I.iii.130). Eventually it is agreed that Antonio's bond will be "a pound of flesh" but Antonio is very sure that it will not come to this.