Simple rotation animation using command-line python script
In these two lines, you are rotating on the z-axis and then keying the x-axis, which means you aren't doing any animation.

mycube.rotation_euler = (0,0,180) # (x, y, z)
mycube.keyframe_insert('rotation_euler', index=0 ,frame=100) # index=0 is x-axis


Changing the axis you keyframe will most likely not provide the expected result. While by default blender's UI uses degrees for rotation, when setting rotations in python you need to specify in radians, which means it will be rotating over 10,000 degrees in 100 frames.

Also note that to properly change the current frame you should use frame_set(), but you don't have to change frames in your script as the keyframe_insert() specifies what frame the value is set for.

import bpy
import math

scene = bpy.data.scenes["Scene"]
mycube = bpy.data.objects['Cube']
mycube.rotation_mode = 'XYZ'

scene.frame_start = 1
scene.frame_end = 100

mycube.rotation_euler = (0, 0, 0)
mycube.keyframe_insert('rotation_euler', index=2 ,frame=1)

mycube.rotation_euler = (0, 0, math.radians(180))
mycube.keyframe_insert('rotation_euler', index=2 ,frame=100)

scene.render.use_stamp = 1
scene.render.stamp_background = (0,0,0,1)

scene.render.filepath = "render/anim"
scene.render.image_settings.file_format = "AVI_JPEG"
bpy.ops.render.render(animation=True)