The Arthanārīśvara form of śiva is quite famous. It depicts the equality of Male and female energy in the universe. There is also a hymn dedicated to Arthanārīśvara form called Arthanārīśvara stotram composed by Adi Shankaracharya and also Arthanārīśvara ashtakam which is written by sage Upamanyu.
Lord Shiva exists in Ardhanaarishwara(pronounced as Arthanārīśvara in IAST) from the beginning of time because Shiva and Shakti are inseparable. But the story of Lord Shiva appearing as Ardhanaarishwara is described in Shiva Mahapurana, Shatarudra Samhita, Chapter 3. The story goes like this: At the beginning of creation when Lord Brahma was creating people but they were very less in number. Then he became frustrated and then the a divine sound from sky said him to continue production by couples. Then Lord Brahma meditated on Lord Shiva united with Shakti. Then Lord Shiva pleased with him and take the form of Ardhanaarishwara and appeared before Lord Brahma and guided him to increase progeny.
श्रृणु तात! महाप्राज्ञ! विधिकामप्रपूरकम्।
अर्द्धनारीनराख्यं हि शिवरूपमनुत्तमम्॥ १॥
Nandisvara said, “O Great intellectual one, O Dear one, you kindly describe the excellent Siva's form of Ardhanarisvara which fulfilled the desires of Brahma.
यदा सृष्टाः प्रजाः सर्वा न व्यवर्द्धन्त वेधसा।
तदा चिन्ताकुलोऽभूत्स तेन दुःखेन दुःखितः ॥ २॥
When there had been little evolution of the people created by Brahma, he felt extremely painful.
नभोवाणी तदाऽभूद्वै सृष्टिं मिथुनजां कुरु।
तच्छ्रुत्वा मैथुनीं सृष्टिं ब्रह्मा कर्तुममन्यत॥ ३॥
Then there was a divine sound from the sky said, "Carry on the creation produced by the couples' (i.e. the male and the female). Then Brahma thought of the creation based on the sexual relations.
नारीणां कुलमीशानान्निर्गतं न पुरा यतः।
ततो मैथुनजां सृष्टिं कर्तुं शेके न पद्मभूः॥४॥
Earlier to that the race had not appeared out of the sexual intercourse with the females. Therefore Brahma could not create the world based on sexual relationship earlier.
प्रभावेणा विना शम्भोर्न जायेरन्त्रिमाः प्रजाः।
एवं सञ्चिन्तयन्ब्रह्मा तपः कर्तुं प्रचक्रमे॥ ५॥
Brahma thought that the creation cannot be progressed without the influence of Šiva. Therefore he started performing tapas.
शिवाय परया शक्त्या संयुक्त परमेश्वरम्।
सञ्चिन्त्य हृदये प्रीत्या तपेशं परमं तपः।। ६॥
Then he meditated upon Siva united with the great Sakti called Siva in a combined way performing severe tapas.
तीव्रेण तपसा तस्य संयुक्तस्य स्वयम्भुवः।
अचिरेणैव कालेन तुतोष स शिवो द्रुतम्॥७॥
Observing the severe austerities of Brahma, lord Siva was rapidly pleased with him within no time.
ततः पूर्णचिदीशस्य मूर्तिमाविश्य कामदाम्।
अर्द्धनारीनरो भूत्वा ततो ब्रह्मान्तिकं हरः॥८॥
Then Isvara- the form of complete consciousness, entered into the Ardhanarisvara form, representing half male and half female and he appeared before Brahmā.
Similar kind of story with slight variation is also mentioned in Vishnu Purana, Book 1, Chapter 7.
PARÁŚARA.--From Brahmá, continuing to meditate, were born mind-engendered progeny, with forms and faculties derived from his corporeal nature; embodied spirits, produced from the person of that all-wise deity. All these beings, front the gods to inanimate things, appeared as I have related to you, being the abode of the three qualities: but as they did not multiply themselves, Brahmá created other mind-born sons, like himself; namely, Bhrigu, Pulastya, Pulaha, Kratu, Angiras, Maríchi, Daksha, Atri, and Vaśisht́ha: these are the nine Brahmas (or Brahma rishis) celebrated in the Puráńas. Sanandana and the other sons of Brahmá were previously created by him, but they were without desire or passion, inspired with holy wisdom, estranged from the universe, and undesirous of progeny. This when Brahmá perceived, he was filled with wrath capable of consuming the three worlds, the flame of which invested, like a garland, heaven, earth, and hell. Then from his forehead, darkened with angry frowns, sprang Rudra, radiant as the noon-tide sun, fierce, and of vast bulk, and of a figure which was half male, half female.