where does genetic material for antibody production come from?
Does our DNA in some way get modified or something else?


Yes. The DNA gets modified. VDJ recombination and somatic hypermutation are the mechanisms by which this happens. 

You can find an entire book chapter/review on these topics. So I shall not elaborate further.