This term usually describes a Japanese comic book not created for/by the professional market. Usually a self published fan productions, although some famous artists occasionally produce doujinshi, these manga can deal with any variety of topics.
These include but are not limited to parodies of popular series, drawn fanfiction, Yaoi/June/Shounen Ai and Hentai/Ecchi adaptions, and original stories.
Doujinshi artists usually produce for their own amusement and that of other fans rather than for financial gain. They are distributed though some mangashops, such as Mandarake, K-Books, Toranoana and others, but the largest market of doujinshi books is the Comiket, a convention that takes place twice a year in Tokyo's Big Sight and that is devoted almost entirely to the fan market.
The quality of some doujinshi rival professional productions in respects to art, story and presentation. The love for the product is clearly visible in many publications by the luxurious way they are presented.
Some doujinshi artists went on to become famous mangaka, and some stay true to their roots even after their breakthrough and continue to produce other stories for fun to be distributed though the doujinshi channels rather than the large publishing houses with their weekly or monthly magazines. Notable examples include Clamp, some well known Yaoi artists and others.